From 29a5159b4887289c9dd356d4b2a42b1a4d7bd3bb Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Thu, 13 Sep 2018 17:24:23 -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 306d189..f399423 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "license": "MIT", "main": "index.js", "scripts": { - "units": "node test/run.js | tap-spec", + "units": "./bin/units", "test": "npm run units", "travis": "npm test", "lint": "jshint .",