Skip to content

Commit fe611f5

Browse files
committed
modified test-repl-persistent-history to use common.mustCall
1 parent ba7bac5 commit fe611f5

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

test/parallel/test-repl-persistent-history.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,6 @@ const tests = [
193193
const numtests = tests.length;
194194

195195

196-
let testsNotRan = tests.length;
197-
198-
process.on('beforeExit', () =>
199-
assert.strictEqual(testsNotRan, 0)
200-
);
201-
202196
function cleanupTmpFile() {
203197
try {
204198
// Write over the file, clearing any history
@@ -214,6 +208,8 @@ function cleanupTmpFile() {
214208
fs.createReadStream(historyFixturePath)
215209
.pipe(fs.createWriteStream(historyPath)).on('unpipe', () => runTest());
216210

211+
const runTestWrap = common.mustCall(runTest, numtests);
212+
217213
function runTest(assertCleaned) {
218214
const opts = tests.shift();
219215
if (!opts) return; // All done
@@ -283,8 +279,7 @@ function runTest(assertCleaned) {
283279
try {
284280
// Ensure everything that we expected was output
285281
assert.strictEqual(expected.length, 0);
286-
testsNotRan--;
287-
setImmediate(runTest, cleaned);
282+
setImmediate(runTestWrap, cleaned);
288283
} catch (err) {
289284
console.error(`Failed test # ${numtests - tests.length}`);
290285
throw err;

0 commit comments

Comments
 (0)