Skip to content

Commit e1dbbd2

Browse files
committed
fix watch mode
1 parent e459f70 commit e1dbbd2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/internal/test_runner/runner.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const {
1010
ArrayPrototypeSome,
1111
ArrayPrototypeSort,
1212
ArrayPrototypeSplice,
13+
MathMax,
1314
Number,
1415
ObjectAssign,
1516
PromisePrototypeThen,
@@ -335,7 +336,7 @@ function runTestFile(path, root, inspectPort, filesWatcher) {
335336
const index = ArrayPrototypeIndexOf(root.subtests, subtest);
336337
if (index !== -1) {
337338
ArrayPrototypeSplice(root.subtests, index, 1);
338-
root.waitingOn--;
339+
root.waitingOn = MathMax(0, root.waitingOn - 1);
339340
}
340341
});
341342
}

test/parallel/test-runner-watch-mode.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ async function testWatch({ files, fileToUpdate }) {
1515
child.stdout.on('data', (data) => {
1616
stdout += data.toString();
1717
const matches = stdout.match(/test has ran/g);
18-
if (matches?.length >= 1) ran1.resolve();
19-
if (matches?.length >= 2) ran2.resolve();
18+
if (matches?.length >= 2) ran1.resolve();
19+
if (matches?.length >= 4) ran2.resolve();
2020
});
2121

2222
await ran1.promise;

0 commit comments

Comments
 (0)