diff --git a/test/sequential/test-watch-mode.mjs b/test/sequential/test-watch-mode.mjs index 92839814ba280a..9baf3714477f20 100644 --- a/test/sequential/test-watch-mode.mjs +++ b/test/sequential/test-watch-mode.mjs @@ -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)}` },