From d4f6ee0d6ae75ac3d5228934a9585908abde81a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6nnemann?= Date: Sat, 4 Apr 2015 15:32:21 +0200 Subject: [PATCH] chore: make test command cleanup after itself and fail early for style errors --- bin/post-test | 9 --------- bin/{pre-test => test} | 20 +++++++++++++++++++- package.json | 6 +++--- 3 files changed, 22 insertions(+), 13 deletions(-) delete mode 100755 bin/post-test rename bin/{pre-test => test} (58%) diff --git a/bin/post-test b/bin/post-test deleted file mode 100755 index 8b77be26..00000000 --- a/bin/post-test +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -cat .tmp/sinopia.pid | xargs kill - -cat .tmp/ghrs.pid | xargs kill - -cp .tmp/.npmrc ~/.npmrc - -rm -rf .tmp diff --git a/bin/pre-test b/bin/test similarity index 58% rename from bin/pre-test rename to bin/test index d2c1ff4a..91dc5924 100755 --- a/bin/pre-test +++ b/bin/test @@ -1,7 +1,23 @@ -#!/bin/sh +#!/bin/bash set -e +npm run test:style + +function cleanup { + set +e + + cp .tmp/.npmrc ~/.npmrc + + cat .tmp/sinopia.pid | xargs kill + + cat .tmp/ghrs.pid | xargs kill + + rm -rf .tmp +} + +trap cleanup EXIT + [ -d ".tmp" ] && ./bin/post-test mkdir -p .tmp/modules @@ -16,3 +32,5 @@ sleep 0.5 cp ~/.npmrc .tmp/.npmrc cp tests/.npmrc ~/.npmrc + +npm run test:integration diff --git a/package.json b/package.json index 95a179d9..d878c8bd 100644 --- a/package.json +++ b/package.json @@ -55,9 +55,9 @@ }, "scripts": { "postpublish": "./bin/semantic-release.js post", - "posttest": "./bin/post-test", "prepublish": "./bin/semantic-release.js pre", - "pretest": "./bin/pre-test", - "test": "standard && node tests | tap-spec" + "test:style": "standard", + "test:integration": "node tests | tap-spec", + "test": "./bin/test" } }