Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Chemi Atlow <chemi@atlow.co.il>
  • Loading branch information
mcollina and atlowChemi committed Jul 18, 2024
commit 37247a74390578d471627d79a680406848cfcee4
30 changes: 7 additions & 23 deletions test/parallel/test-runner-run-watch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,31 +87,15 @@ async function testWatch({ fileToUpdate, file, action = 'update', cwd = tmpdir.p

for (const run of runs) {
assert.doesNotMatch(run, /run\(\) is being called recursively/);
assert.doesNotMatch(run, /MODULE_NOT_FOUND/);
assert.match(run, /# tests 1/);
assert.match(run, /# pass 1/);
assert.match(run, /# fail 0/);
assert.match(run, /# cancelled 0/);
}
};

const testRename2 = async () => {
await ran1.promise;
const fileToRenamePath = tmpdir.resolve(fileToUpdate);
const newFileNamePath = tmpdir.resolve(`test-renamed-${fileToUpdate}`);
const interval = setInterval(() => renameSync(fileToRenamePath, newFileNamePath), common.platformTimeout(1000));
await ran2.promise;
runs.push(currentRun);
clearInterval(interval);
child.kill();

for (const run of runs) {
assert.doesNotMatch(run, /run\(\) is being called recursively/);
if (action === 'rename2') {
assert.match(run, /MODULE_NOT_FOUND/);
} else {
assert.doesNotMatch(run, /MODULE_NOT_FOUND/);
}
assert.match(run, /# tests 1/);
assert.match(run, /# pass 1/);
assert.match(run, /# fail 0/);
assert.match(run, /# cancelled 0/);
assert.match(run, /MODULE_NOT_FOUND/);
}
};
Comment thread
mcollina marked this conversation as resolved.

Expand Down Expand Up @@ -163,7 +147,7 @@ describe('test runner watch mode', () => {
await testWatch({ fileToUpdate: 'test.js', action: 'rename' });
});

it('should not throw when delete a watched test file', async () => {
it('should not throw when deleting a watched test file', async () => {
await testWatch({ fileToUpdate: 'test.js', action: 'delete' });
});

Expand All @@ -176,7 +160,7 @@ describe('test runner watch mode', () => {
});
});

it('should handle ranames in a different cwd', async () => {
it('should handle renames in a different cwd', async () => {
await testWatch({
file: join(tmpdir.path, 'test.js'),
fileToUpdate: 'test.js',
Expand Down