From 5579f121a97a465e375ab04a9a5c5c22fb612dba Mon Sep 17 00:00:00 2001 From: Corey Frang <gnarf37@gmail.com> Date: Thu, 10 May 2018 16:08:54 -0400 Subject: [PATCH] Fix a thread status check in integration tests to allow "done" threads --- test/integration/scratch-tests.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/integration/scratch-tests.js b/test/integration/scratch-tests.js index fa9321db..651b544d 100644 --- a/test/integration/scratch-tests.js +++ b/test/integration/scratch-tests.js @@ -35,9 +35,12 @@ const testFile = file => test(file, async t => { return Promise.resolve() .then(async () => { // waiting for all threads to complete, then we return - while (vm.runtime.threads.length > 0) { + + while (vm.runtime.threads.filter(thread => vm.runtime.isActiveThread(thread)).length > 0) { if ((Date.now() - startTime) >= TIMEOUT) { - messages.push(`fail Threads still running after ${TIMEOUT}ms`); + // if we push the message after end, the failure from tap is not very useful: + // "not ok test after end() was called" + messages.unshift(`fail Threads still running after ${TIMEOUT}ms`); break; }