Skip to content

Commit 608c309

Browse files
cool88MylesBorins
authored andcommitted
test: refactored test-repl-persistent-history
PR-URL: #12703 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent aaf8044 commit 608c309

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,6 @@ const tests = [
204204
constnumtests=tests.length;
205205

206206

207-
lettestsNotRan=tests.length;
208-
209-
process.on('beforeExit',()=>
210-
assert.strictEqual(testsNotRan,0)
211-
);
212-
213207
functioncleanupTmpFile(){
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+
construnTestWrap=common.mustCall(runTest,numtests);
223+
228224
functionrunTest(assertCleaned){
229225
constopts=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
throwerr;

0 commit comments

Comments
 (0)