Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVA 6 watch mode #3218

Merged
merged 5 commits into from
Jul 2, 2023
Merged

AVA 6 watch mode #3218

merged 5 commits into from
Jul 2, 2023

Conversation

novemberborn
Copy link
Member

@novemberborn novemberborn commented Jun 27, 2023

Rely on recursive fs.watch(), rather than Chokidar. On Linux this is supported from Node.js 20 onwards. It won't work for network shares and Docker volume mounts which would require polling, we'll find out if that's a problem or not.

Use @vercel/nft to perform static dependency analysis, supporting ESM and CJS imports for JavaScript & TypeScript source files. This is a huge improvement over the previous runtime tracking of CJS imports, which did not support ESM.

Rewrite the change handling logic to be easier to follow (though it's still pretty complicated).

Improve integration with @ava/typescript. The watcher can now detect a change to a TypeScript source file, then wait for the corresponding build output to change before re-running tests. See avajs/typescript#46.


Because this is a big change, and due to the Linux and network share implications, the previous implementation can be enabled:

export default {
	watcher: 'ava5+chokidar'
}

You will need to manually install chokidar however.

Tests for the previous implementation have been removed. They've been hard to maintain. We're not expecting to make any / many code changes so hopefully we'll be all right.


Other changes:

  • Remove undocumented ability to start watch mode via the config. Require the CLI flag instead.
  • Add ava.config.mjs to default watcher ignore patterns
  • Ignore changes to failed-tests file in watcher

@novemberborn novemberborn mentioned this pull request Jun 27, 2023
5 tasks
@novemberborn novemberborn force-pushed the ava6-watcher branch 2 times, most recently from ef3c72e to 426ac22 Compare June 29, 2023 20:27
@novemberborn novemberborn marked this pull request as ready for review June 30, 2023 20:14
@novemberborn novemberborn force-pushed the ava6-watcher branch 9 times, most recently from c8317d7 to 31f0bcf Compare July 2, 2023 07:49
* Remove undocumented ability to start watch mode via the config. Require the CLI flag instead
* Watch mode is no longer 'relatively new'
* Add ava.config.mjs to default watcher ignore patterns
* Ignore changes to failed-tests file in watcher

Logger cleanup:

* Remove obsolete clearLogOnNextRun option
* Track firstRun for reporter
Restrict @ava/typescript to the ava-3.2 protocol, since the legacy code is not compatible with the ava-6 protocol.

Remove brittle tests for the legacy code.
Rely on recursive fs.watch(), rather than Chokidar. On Linux this is supported from Node.js 20 onwards. It won't work for network shares and Docker volume mounts which would require polling, we'll find out if that's a problem or not. (For now, the previous implementation is still available.)

Use @vercel/nft to perform static dependency analysis, supporting ESM and CJS imports for JavaScript & TypeScript source files. This is a huge improvement over the previous runtime tracking of CJS imports, which did not support ESM.

Rewrite the change handling logic to be easier to follow (though it's still pretty complicated).

Improve integration with `@ava/typescript`. The watcher can now detect a change to a TypeScript source file, then wait for the corresponding build output to change before re-running tests.
* Run tests on macOS
* Use Bash shell
* Run watch mode test separately and serially
@novemberborn novemberborn merged commit 6cc417b into main Jul 2, 2023
@novemberborn novemberborn deleted the ava6-watcher branch July 2, 2023 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant