Skip to content

Commit 7ff9b12

Browse files
committed
use npm to test via node
1 parent 442f8fb commit 7ff9b12

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ services:
77

88
before_install:
99
- docker build -t eficode/wait-for .
10+
11+
script:
12+
- npm install
13+
- ./run_tests.sh
1014
- docker run eficode/wait-for

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ WORKDIR /app
88
COPY . /app
99
RUN npm install
1010

11-
CMD ./node_modules/.bin/bats wait-for.bats
11+
# On launch, run the test suite via npm
12+
CMD npm test

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "wait-for",
33
"version": "0.1.0",
44
"scripts": {
5-
"test": "./node_modules/.bin/bats wait-for.bats"
5+
"test": "./run_tests.sh"
66
},
77
"dependencies": {
88
"bats": "^0.4.2"

run_tests.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
# Although it would be possible to just call this directly from the Dockerfile,
4+
# centralizing tests in this file allows both the docker container and the
5+
# CI machine to run the same set of tests for an additional datapoint --
6+
# which gives a better chance of turning up POSIX noncompliance
7+
8+
./node_modules/.bin/bats wait-for.bats

wait-for

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
OLD_TIMEOUT=$TIMEOUT
44
OLD_QUIET=$QUIET

0 commit comments

Comments
 (0)