Skip to content

Commit 2cdba95

Browse files
test: rewrite unseen watch changes instead of only touching their mtime
On macOS a re-created file went unseen through three mtime-only re-touches (restored-commonjs-reexport). Rewriting the file emits a content change, and two more tries give a slow runner room.
1 parent 6ddb6af commit 2cdba95

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎test/templates/WatchTestCases.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const testRootDirectory = path.join(__dirname, "..");
3636
const STEP_DELAY = 200;
3737
const AGGREGATE_TIMEOUT = 50;
3838
const RETOUCH_DELAY = 1000;
39-
const RETOUCH_LIMIT = 3;
39+
const RETOUCH_LIMIT = 5;
4040

4141
/**
4242
* @param {string} src src
@@ -381,10 +381,12 @@ const describeCases = (config) => {
381381
)
382382
);
383383
}
384-
// macOS can drop a change event entirely
385-
const now = new Date();
384+
// macOS can drop a change event entirely, and a timestamp-only
385+
// touch can go unseen too for a re-created file, so rewrite it
386386
for (const file of unseenChanges) {
387-
if (fs.existsSync(file)) fs.utimesSync(file, now, now);
387+
if (fs.existsSync(file)) {
388+
fs.writeFileSync(file, fs.readFileSync(file));
389+
}
388390
}
389391
retouchUnseenChanges(compilers, retries - 1);
390392
}, RETOUCH_DELAY);

0 commit comments

Comments
 (0)