diff --git a/test.mjs b/test.mjs index 86082243..4cbdbae3 100644 --- a/test.mjs +++ b/test.mjs @@ -4,7 +4,7 @@ import fs from 'node:fs'; import sysPath from 'node:path'; -import {fileURLToPath} from 'node:url'; +import {fileURLToPath, pathToFileURL} from 'node:url'; import {promisify} from 'node:util'; import childProcess from 'node:child_process'; import chai from 'chai'; @@ -543,14 +543,13 @@ const runTests = (baseopts) => { watcher.on(EV.UNLINK, unlinkSpy).on(EV.ADD_DIR, addSpy); await waitForWatcher(watcher); - await delay(); + await delay(300); await fs_unlink(testPath); - await delay(); + await delay(300); await fs_mkdir(testPath, PERM_ARR); - await waitFor([unlinkSpy]); + await waitFor([addSpy, unlinkSpy]); unlinkSpy.should.have.been.calledWith(testPath); - await waitFor([addSpy]); addSpy.should.have.been.calledWith(testPath); }); }); @@ -2026,7 +2025,9 @@ const runTests = (baseopts) => { }); it('should not prevent the process from exiting', async () => { const scriptFile = getFixturePath('script.js'); - const chokidarPath = upath.join(__dirname, 'lib/index.js').replace(/\\/g, '\\\\'); + const chokidarPath = pathToFileURL(sysPath.join(__dirname, 'lib/index.js')) + .href + .replace(/\\/g, '\\\\'); const scriptContent = ` (async () => { const chokidar = await import("${chokidarPath}");