Skip to content

Commit

Permalink
chore(test): Use dedicated test script to catch errors
Browse files Browse the repository at this point in the history
The way we were running our unit tests does not catch fatal errors in
the unit test run, even though they return non-zero status codes.

By using a dedicated script to run the tests, with the `pipefail`
option, we can catch them.

Connects pelias/pelias#744
  • Loading branch information
orangejulius committed Sep 13, 2018
1 parent 0e1eea2 commit 8925432
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions bin/units
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# run tests with pipefail to avoid false passes
# see https://github.com/pelias/pelias/issues/744
set -o pipefail

node test/run.js | npx tap-spec
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"homepage": "https://github.com/pelias/pbf2json",
"license": "MIT",
"scripts": {
"units": "node test/run.js | tap-spec",
"units": "./bin/units",
"test": "npm run units",
"pretest": "test/pretest.sh",
"end-to-end": "npm run pretest; node test/end-to-end.js;",
Expand Down

0 comments on commit 8925432

Please sign in to comment.