From d6478d2217c876b917f82ce822fa9068534ae62a Mon Sep 17 00:00:00 2001 From: nacd <58849583+nacd@users.noreply.github.com> Date: Fri, 13 Dec 2019 16:06:20 +0100 Subject: [PATCH] fix flaky test in remove.test.js (#736) --- lib/remove/__tests__/remove.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/remove/__tests__/remove.test.js b/lib/remove/__tests__/remove.test.js index 5add5997..ff14ae69 100644 --- a/lib/remove/__tests__/remove.test.js +++ b/lib/remove/__tests__/remove.test.js @@ -70,11 +70,12 @@ describe('remove', () => { fs.writeFileSync(file, 'hello') assert(fs.existsSync(file)) - const existsChecker = setInterval(() => { + let existsChecker = setInterval(() => { fse.pathExists(file, (err, itDoes) => { assert.ifError(err) - if (!itDoes) { + if (!itDoes && existsChecker) { clearInterval(existsChecker) + existsChecker = null done() } })