From bd26d72e99b754e5eaf75347c7ac242e5e051936 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 4 Apr 2016 14:37:26 +0200 Subject: [PATCH] Resolve race condition in tests by keeping event loop alive Add a dummy setTimeout() call that keeps the event loop alive long enough to receive signals. There may be better ways to do this, but this is simple and seems sufficiently reliable. --- test/fixtures/script.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/fixtures/script.js b/test/fixtures/script.js index 51f518a..3ccd0c9 100755 --- a/test/fixtures/script.js +++ b/test/fixtures/script.js @@ -1,3 +1,6 @@ #!/usr/bin/env node console.log('%j', process.execArgv) console.log('%j', process.argv.slice(2)) + +// Keep the event loop alive long enough to receive signals. +setTimeout(function() {}, 100)