Skip to content

Commit

Permalink
test: fix watch mode test flake
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#44739
Backport-PR-URL: nodejs/node#44976
Fixes: nodejs/node#44735
Reviewed-By: Erick Wendel <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
MoLow authored and guangwong committed Jan 3, 2023
1 parent 6636478 commit f2117be
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/sequential/test-watch-mode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ describe('watch mode', { concurrency: true, timeout: 60_0000 }, () => {
const file = fixtures.path('watch-mode/failing.js');
const { stderr, stdout } = await spawnWithRestarts({ file });

// Use match first to pretty print diff on failure
assert.match(stderr, /Error: fails\r?\n/);
assert.strictEqual(stderr.match(/Error: fails\r?\n/g).length, 2);
// Test that failures happen once per restart
assert(stderr.match(/Error: fails\r?\n/g).length >= 2);
assertRestartedCorrectly({
stdout,
messages: { completed: `Failed running ${inspect(file)}`, restarted: `Restarting ${inspect(file)}` },
Expand Down Expand Up @@ -206,7 +208,9 @@ describe('watch mode', { concurrency: true, timeout: 60_0000 }, () => {
});
});

it('should not load --import modules in main process', async () => {
it('should not load --import modules in main process', {
skip: 'enable once --import is backported',
}, async () => {
const file = createTmpFile('');
const imported = fixtures.fileURL('watch-mode/process_exit.js');
const args = ['--import', imported, file];
Expand Down

0 comments on commit f2117be

Please sign in to comment.