Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
jakecastelli committed Jun 28, 2024
1 parent c583049 commit e270e58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 3 additions & 4 deletions lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,19 +425,18 @@ function watchFiles(testFiles, opts) {
const newFileName = ArrayPrototypeFind(updatedTestFiles, (x) => !ArrayPrototypeIncludes(testFiles, x));
const previousFileName = ArrayPrototypeFind(testFiles, (x) => !ArrayPrototypeIncludes(updatedTestFiles, x));

testFiles = updatedTestFiles;

// When file renamed
if (newFileName && previousFileName) {
owners = new SafeSet().add(newFileName);
watcher.filterFile(resolve(newFileName), owners);
}

// When file deleted
if (!newFileName && previousFileName) {
testFiles = updatedTestFiles;
return;
return; // Avoid rerunning files when file deleted
}

testFiles = updatedTestFiles;
}

watcher.unfilterFilesOwnedBy(owners);
Expand Down
7 changes: 5 additions & 2 deletions test/parallel/test-runner-watch-mode-complex.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ import 'data:text/javascript,';
test('test to delete has ran');`,
};

const fixturePaths = Object.keys(fixtureContent)
.reduce((acc, file) => ({ ...acc, [file]: tmpdir.resolve(file) }), {});
const fixturePaths = Object.fromEntries(Object.keys(fixtureContent)
.map((file) => [file, tmpdir.resolve(file)]));

console.log(fixturePaths)

Check failure on line 47 in test/parallel/test-runner-watch-mode-complex.mjs

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 0 spaces but found 2

Check failure on line 47 in test/parallel/test-runner-watch-mode-complex.mjs

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Missing semicolon

Object.entries(fixtureContent)
.forEach(([file, content]) => writeFileSync(fixturePaths[file], content));

Expand Down

0 comments on commit e270e58

Please sign in to comment.