Skip to content

Commit

Permalink
Ensure watch mode works outside of its integration tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
novemberborn committed Dec 6, 2023
1 parent cf7a288 commit 32f282f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/cli.js
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions lib/watcher.js
Expand Up @@ -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;
}

Expand Down

0 comments on commit 32f282f

Please sign in to comment.