Skip to content

Commit 6058c43

Browse files
cool88addaleax
authored andcommitted
test: refactored test-repl-persistent-history
PR-URL: #12703 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent dac9f42 commit 6058c43

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

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

+3-8
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,6 @@ const tests = [
204204
const numtests = tests.length;
205205

206206

207-
let testsNotRan = tests.length;
208-
209-
process.on('beforeExit', () =>
210-
assert.strictEqual(testsNotRan, 0)
211-
);
212-
213207
function cleanupTmpFile() {
214208
try {
215209
// Write over the file, clearing any history
@@ -225,6 +219,8 @@ function cleanupTmpFile() {
225219
fs.createReadStream(historyFixturePath)
226220
.pipe(fs.createWriteStream(historyPath)).on('unpipe', () => runTest());
227221

222+
const runTestWrap = common.mustCall(runTest, numtests);
223+
228224
function runTest(assertCleaned) {
229225
const opts = tests.shift();
230226
if (!opts) return; // All done
@@ -294,8 +290,7 @@ function runTest(assertCleaned) {
294290
try {
295291
// Ensure everything that we expected was output
296292
assert.strictEqual(expected.length, 0);
297-
testsNotRan--;
298-
setImmediate(runTest, cleaned);
293+
setImmediate(runTestWrap, cleaned);
299294
} catch (err) {
300295
console.error(`Failed test # ${numtests - tests.length}`);
301296
throw err;

0 commit comments

Comments
 (0)