Skip to content

Commit

Permalink
fix: ensure test scripts only kill node process
Browse files Browse the repository at this point in the history
This commit is a critical fix to make sure the test scripts only kill
the process they started, rather than all node processes globally.  This
had the side effect of killing any other node instances, including `npm`
downloads and `node-gyp` builds.  It has been fixed.
  • Loading branch information
jniles committed Apr 27, 2016
1 parent 1e563c4 commit 6f548c8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 1 addition & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const SERVER_FOLDER = './bin/server/';
// the output folder for built client files
const CLIENT_FOLDER = './bin/client/';


// resource paths
var paths = {
client : {
Expand Down Expand Up @@ -216,7 +215,7 @@ gulp.task('client-lint-i18n', function (cb) {
});
});

// watchs for any change and builds the appropriate route
// watches for any change and builds the appropriate route
gulp.task('watch-client', function () {
gulp.watch(paths.client.css, ['client-minify-css']);
gulp.watch(paths.client.javascript, ['client-compile-js']);
Expand Down
11 changes: 7 additions & 4 deletions sh/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ mysql -u $DB_USER -p$DB_PASS $DB_NAME < server/models/test/data.sql
echo "Building server ...."

# build and start the server
npm run dev &
./node_modules/.bin/gulp build
cd bin
NODE_ENV=development node server/app.js &
NODE_PID=$!

# make sure we have enough time for the server to start
sleep $TIMEOUT
Expand All @@ -32,7 +35,7 @@ echo "Running tests ..."
# run the tests
mocha server/test/api/

echo "Cleaning up node instances ..."
echo "Cleaning up test instance"

# kill the server (and all other matching processes)
killall node
# kill the server
kill $NODE_PID
10 changes: 7 additions & 3 deletions sh/test-ends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ mysql -u $DB_USER -p$DB_PASS $DB_NAME < server/models/test/data.sql
echo "Building server ...."

# build and start the server
npm run dev &
./node_modules/.bin/gulp build
cd bin
NODE_ENV=development node server/app.js &
NODE_PID=$!

# make sure we have enough time for the server to start
echo "Sleeping for $TIMEOUT"
sleep $TIMEOUT

echo "Running tests ..."
Expand All @@ -34,5 +38,5 @@ gulp client-test-e2e

echo "Cleaning up node instances ..."

# kill the server (and all other matching processes)
killall node
# kill the server
kill $NODE_PID

0 comments on commit 6f548c8

Please sign in to comment.