Skip to content

Commit

Permalink
fix watch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow committed Apr 23, 2023
1 parent e459f70 commit e1dbbd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const {
ArrayPrototypeSome,
ArrayPrototypeSort,
ArrayPrototypeSplice,
MathMax,
Number,
ObjectAssign,
PromisePrototypeThen,
Expand Down Expand Up @@ -335,7 +336,7 @@ function runTestFile(path, root, inspectPort, filesWatcher) {
const index = ArrayPrototypeIndexOf(root.subtests, subtest);
if (index !== -1) {
ArrayPrototypeSplice(root.subtests, index, 1);
root.waitingOn--;
root.waitingOn = MathMax(0, root.waitingOn - 1);
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-runner-watch-mode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ async function testWatch({ files, fileToUpdate }) {
child.stdout.on('data', (data) => {
stdout += data.toString();
const matches = stdout.match(/test has ran/g);
if (matches?.length >= 1) ran1.resolve();
if (matches?.length >= 2) ran2.resolve();
if (matches?.length >= 2) ran1.resolve();
if (matches?.length >= 4) ran2.resolve();
});

await ran1.promise;
Expand Down

0 comments on commit e1dbbd2

Please sign in to comment.