From 6d736a56d8382845ab0dea3d1b4b610988d13b4d Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Mon, 3 Oct 2022 15:16:22 +0300 Subject: [PATCH] test: fix watch mode test flake PR-URL: https://github.com/nodejs/node/pull/44739 Backport-PR-URL: https://github.com/nodejs/node/pull/44976 Fixes: https://github.com/nodejs/node/issues/44735 Reviewed-By: Erick Wendel Reviewed-By: Rafael Gonzaga Reviewed-By: Benjamin Gruenbaum --- test/sequential/test-watch-mode.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/sequential/test-watch-mode.mjs b/test/sequential/test-watch-mode.mjs index bfe8f08f94c08e..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)}` }, @@ -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];