From 32f282fc2163f9088803995536c2b461594e0d66 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Wed, 6 Dec 2023 22:18:23 +0100 Subject: [PATCH 1/2] Ensure watch mode works outside of its integration tests Somewhere between developing the watch mode and adding test coverage, a mechanism was introduced to control watch mode in its integration tests. Ironically watch mode relied on this mechanism and no longer worked in actual use. Fixes #3270 --- lib/cli.js | 2 +- lib/watcher.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index cc00b45a3..e517acc6e 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -522,7 +522,7 @@ export default async function loadCli() { // eslint-disable-line complexity providers, reporter, stdin: process.stdin, - signal: abortController.signal, + signal: abortController?.signal, }); } else { let debugWithoutSpecificFile = false; diff --git a/lib/watcher.js b/lib/watcher.js index 470a32229..cf29c5518 100644 --- a/lib/watcher.js +++ b/lib/watcher.js @@ -370,15 +370,15 @@ async function * plan({api, filter, globs, projectDir, providers, stdin, abortSi } }); - abortSignal.addEventListener('abort', () => { + abortSignal?.addEventListener('abort', () => { signalChanged?.({}); }); // And finally, the watch loop. - while (!abortSignal.aborted) { + while (abortSignal?.aborted !== true) { const {testFiles: files = [], runOnlyExclusive = false} = await changed; // eslint-disable-line no-await-in-loop - if (abortSignal.aborted) { + if (abortSignal?.aborted) { break; } From 5975b602b771e0dc02382d24b65c5561bd5fc7ee Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Wed, 6 Dec 2023 22:19:04 +0100 Subject: [PATCH 2/2] 6.0.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6e43e8014..aee814ebf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ava", - "version": "6.0.0", + "version": "6.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ava", - "version": "6.0.0", + "version": "6.0.1", "license": "MIT", "dependencies": { "@vercel/nft": "^0.24.4", diff --git a/package.json b/package.json index 5d22b225f..984c501e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ava", - "version": "6.0.0", + "version": "6.0.1", "description": "Node.js test runner that lets you develop with confidence.", "license": "MIT", "repository": "avajs/ava",