From 892543217f944b55439aab974c0392d03a9fc097 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Thu, 13 Sep 2018 17:29:22 -0400 Subject: [PATCH] chore(test): Use dedicated test script to catch errors 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 https://github.com/pelias/pelias/issues/744 --- bin/units | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 bin/units diff --git a/bin/units b/bin/units new file mode 100755 index 0000000..4c12226 --- /dev/null +++ b/bin/units @@ -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 diff --git a/package.json b/package.json index 966f666..4d21a9e 100644 --- a/package.json +++ b/package.json @@ -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;",