Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions test/common/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async function testRunnerWatch({
child.stdout.on('data', (data) => {
stdout += data.toString();
currentRun += data.toString();
const testRuns = stdout.match(/duration_ms\s\d+/g);
const testRuns = stdout.match(/^\S+ duration_ms\s\d+/gm);
if (testRuns?.length >= 1) ran1.resolve();
if (testRuns?.length >= 2) ran2.resolve();
});
Expand All @@ -118,18 +118,11 @@ async function testRunnerWatch({
const content = fixtureContent[fileToUpdate];
const path = fixturePaths[fileToUpdate];

if (useRunApi) {
const interval = setInterval(
() => writeFileSync(path, content),
common.platformTimeout(1000),
);
await ran2.promise;
clearInterval(interval);
} else {
writeFileSync(path, content);
await setTimeout(common.platformTimeout(1000));
await ran2.promise;
}
await performFileOperation(
() => writeFileSync(path, content),
useRunApi,
);
await ran2.promise;

runs.push(currentRun);
child.kill();
Expand Down
Loading