From 3b731fee97c689029b18c979840750d293091b60 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Wed, 12 Oct 2022 08:58:29 +0200 Subject: [PATCH] Make watch tests more resilient Ensure that new event listeners are created synchronously after a function handler --- test/watch/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/watch/index.js b/test/watch/index.js index e91af31ad16..e444f6b3ad2 100644 --- a/test/watch/index.js +++ b/test/watch/index.js @@ -61,10 +61,11 @@ describe('rollup.watch', () => { } }); } else { - Promise.resolve() - .then(() => wait(timeout)) // gah, this appears to be necessary to fix random errors - .then(() => next(event)) - .then(go) + wait(timeout) // gah, this appears to be necessary to fix random errors + .then(() => { + next(event); + go(); + }) .catch(error => { watcher.close(); reject(error);