From fe611f5bc5eaadb74cd9220a7673daee41d69d7b Mon Sep 17 00:00:00 2001 From: cool88 Date: Tue, 2 May 2017 23:55:48 +0530 Subject: [PATCH] modified test-repl-persistent-history to use common.mustCall --- test/parallel/test-repl-persistent-history.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-repl-persistent-history.js b/test/parallel/test-repl-persistent-history.js index 6d95f932ccae45..19380c94634c92 100644 --- a/test/parallel/test-repl-persistent-history.js +++ b/test/parallel/test-repl-persistent-history.js @@ -193,12 +193,6 @@ const tests = [ const numtests = tests.length; -let testsNotRan = tests.length; - -process.on('beforeExit', () => - assert.strictEqual(testsNotRan, 0) -); - function cleanupTmpFile() { try { // Write over the file, clearing any history @@ -214,6 +208,8 @@ function cleanupTmpFile() { fs.createReadStream(historyFixturePath) .pipe(fs.createWriteStream(historyPath)).on('unpipe', () => runTest()); +const runTestWrap = common.mustCall(runTest, numtests); + function runTest(assertCleaned) { const opts = tests.shift(); if (!opts) return; // All done @@ -283,8 +279,7 @@ function runTest(assertCleaned) { try { // Ensure everything that we expected was output assert.strictEqual(expected.length, 0); - testsNotRan--; - setImmediate(runTest, cleaned); + setImmediate(runTestWrap, cleaned); } catch (err) { console.error(`Failed test # ${numtests - tests.length}`); throw err;