Fixes#3373. The idle guard will now force a test worker to exit even if it's continuously writing to stdout/stderr.
Co-authored-by: Mark Wubben <mark@novemberborn.net>
This filter function can be used to remove node arguments that may be applied to the main process, but cannot be used to start worker threads. It can only be configured in a JavaScript configuration file. It does not apply when using child processes.
Co-authored-by: Tommy <tmitchell7@uh.edu>
Co-authored-by: Mark Wubben <mark@novemberborn.net>
* Upgrade XO
* Update TypeScript-related dependencies — Don't upgrade @sindresorhus/tsconfig to v6 since it requires TS 5.5 and we test with 5.2.
* Update dev dependencies
* Update dependencies
* Rebuild lockfile
* Upgrade CodeCov action
* Update reporter log instructions and remove deprecation warnings
* Make Node.js 22.6 the recommended development version
* Remove Node.js 21 from the engines list: It's no longer maintained by Node.js itself, see also <https://github.com/avajs/ava/blob/main/docs/support-statement.md>.
* Upgrade xo to v0.57.0 and lint sources, tests, and examples
Disabled `unicorn/prevent-abbreviations` because it introduces too many
opinionated changes.
* Update reporter logs which are sensitive to line numbers changing
---------
Co-authored-by: Mark Wubben <mark@novemberborn.net>
The counters used absolute paths for the test files, but the clearing logic used relative paths. Count using relative paths instead.
The number of previous failures is not observable to the test harness, so this does not come with test coverage.
Fixes#3295.
Register a function to be called when AVA has completed a test run without uncaught exceptions or unhandled rejections.
Fixes#3279.
*
* Completion handlers are invoked in order of registration. Results are not awaited.
* Remove obsolete recipes
ES modules is supported out of the box.
The React recipe applies to AVA 3.
* Remove code guards against obsolete API usage
* Remove references to older AVA versions from documentation
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
Fixes#1718.
With worker threads, this seems to stop AVA from detecting that the thread has exited, causing a hang.
Also remove flush logic implemented in #1722. Let's hope that current Node.js versions are better at flushing IPC before exiting.
* Update dependencies
* Ignore snapshot fixture due to churn
* Remove errant log
* Update GHA actions
* Test type definition with TS 5.3
* Select latest LTS in Volta
* Remove unnecessary npx invocation
* Rebuild lockfile
* Work around legacy tap-based tests choking on our tsconfig.json
No idea why it's even resolving the config when there are no TypeScript tests to run.
Add a new `observeRunsFromConfig` experiment, which allows a test run to be observed by a function installed through an `ava.config.*` file.
The function has access to AVA's internal events, which can then be used to report to a file.
AVA's internal event structure is not currently covered by any SemVer guarantees, which is why this feature requires the experimental opt-in.
Does not currently support watch mode. Only the first run is observed.
When I first retained the AVA 5 logic, it was under the assumption AVA 6 would be released in the summer with another breaking release later in the year. It's now autumn, Node.js 16 is end of life, and for now it's just not worth having this logic around.
Depending on how well the watcher works I'm not opposed to having it as an experimental "select your watch mode" feature though.
* Update dependencies
* Rely on Node.js 18 language features
* Other small changes
* Upgrade to tap@18
* Develop and test with typescript@5.2
* Rebuild lockfile
---------
Co-authored-by: Mark Wubben <mark@novemberborn.net>
* Drop support for Node.js 16
* Change expected Node.js 18 to 18.18
* Change expected Node.js 20 to 20.8
* Add Node.js 21 to the test matrix
* Change snapshot tests to compare decompressed bitstreams
The snapshots are compressed differently in Node.js 21. The compression has been stable for many versions but that is not a guarantee, see https://github.com/nodejs/node/issues/50138 for background.
Change tests to compare the decompressed data instead.
Fixes#3201.
Assertions now throw a `TestFailure` error when they fail. This error is not exported or documented and should not be used or thrown manually. You cannot catch this error in order to recover from a failure, use `t.try()` instead.
All assertions except for `throws` and `throwsAsync` now return `true` when they pass. This is useful for some of the assertions in TypeScript where they can be used as a type guard.
Committing a failed `t.try()` result now also throws.
This commit simplifies error serialization, relying on the advanced IPC for child processes & worker threads. Unnecessary code has been removed.
Possibly breaking changes:
* Renamed and removed fields from the undocumented AssertionError class, including the raw values
* Changes to the undocumented TAP output; stack traces are a bit worse, the rest is about the same but some fields have different names or values
* `nyc` stack frames are no longer ignored; we assume you're using the native code coverage tools
* Track worker errors. They're not native due to https://github.com/nodejs/node/issues/48716, but we want to treat them as such anyway.
* Only treat native errors as errors
* Remove is-error dependency
* Document edge case where `error instanceof Error` can be true, yet AVA does not recognize `error` as an error
See also https://github.com/avajs/ava/pull/2911 for an earlier attempt.
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.
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.
* 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
* Allow loading of ES modules
* Automatically invoke the default export (if any) and await the result
* Pass arguments from the config to the default export (relies on "advanced" IPC for child processes)
* Document that local files are loaded through the providers (e.g. `@ava/typescript`)
Co-authored-by: Mark Wubben <mark@novemberborn.net>
* Test against typescript@5.0
* Default to Node.js 20
* Upgrade XO
* Add reporter logs for Node.js 20
* Update dev dependencies
* Reduce timeouts in reporter tests
This may cause CI failures especially on Windows, but we do waste a lot of time with these tests.
* Inline slash dependency
We need it available in CJS but the package is now ESM only. It's more bothersome to remember to not upgrade the dependency than to inline it.
* Update dependencies
* Rebuild lockfile
* Use latest Codecov action
* Upgrade XO and reformat
* Update dev dependencies
* Test with TypeScript 4.9
* Update dependencies
* Pin latest node@18 for Volta
* Use npm@9
* Rebuild lockfile
* Select Node.js version from Volta pin in most CI jobs
* Only pin npm when testing for lockfile churn; ensure npm@8 for Node.js 14