Commit graph

2049 commits

Author SHA1 Message Date
Mark Wubben
a6f42ea472
Upgrade @ava/test to 6.3.0 2025-05-02 14:42:58 +02:00
Mark Wubben
ca4240db7f
6.3.0 2025-05-02 14:39:27 +02:00
Matthew Douglass
f243cab3b3
Do not count writes to stdout/stderr as non-idling activity for timeouts
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>
2025-04-15 21:59:32 +02:00
Mark Wubben
4abb780b5b
Update dependencies
* Update local node & npm versions through Volta

* Update non-TypeScript dev dependencies

* Update TypeScript dependencies & test matrix

* Update regular dependencies

* Rebuild lockfile
2025-04-14 21:55:05 +02:00
Mark Wubben
024de32a15
6.2.0 2024-10-27 14:36:01 +01:00
Mark Wubben
563fa5f13a
Pre-release updates
* Update dependencies
* Add Node.js >= 23 to test matrix
2024-10-27 14:30:25 +01:00
Romain Lebesle
e5b355d498
Link to CLI options to clarify how to run tests in separate processes
Co-authored-by: Mark Wubben <mark@novemberborn.net>
2024-10-27 14:25:01 +01:00
bojavou
86185b4ef7
Add filterNodeArgumentsForWorkerThreads option
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>
2024-08-20 15:55:43 +02:00
Mark Wubben
b15df53939
Update dependencies & other general maintenance
* 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>.
2024-08-20 15:40:08 +02:00
Mark Wubben
f8bf00cd98
6.1.3 2024-05-05 22:34:07 +02:00
Silas Rech
002b3a0e93
Include Node.js 22 in supported engines and test matrix
Co-authored-by: Mark Wubben <mark@novemberborn.net>
2024-05-05 22:32:41 +02:00
Turadg Aleahmad
ec1a8d2336
Document serial configuration option 2024-04-17 21:20:18 +02:00
Jason Dreyzehner
01ec2804ab
Add VS Code debugging instructions for Yarn PnP projects 2024-03-31 20:49:15 +02:00
Mark Wubben
5d48c953e5
6.1.2 2024-02-28 21:54:32 +01:00
Richard Gibson
be5000aac1
Fix throws assertions rejecting falsy values when any: true
Fixes #3312
2024-02-28 21:51:55 +01:00
Notas Hellout
1d62caf585
Upgrade xo to v0.57.0
* 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>
2024-02-27 22:24:21 +01:00
Mark Wubben
2e0c2b1cef
6.1.1 2024-01-29 22:06:25 +01:00
Mark Wubben
5161bf77d4
Update dependencies 2024-01-29 22:01:59 +01:00
Mark Wubben
15dddf3ff5 Fix external-assertions snapshot for Node.js 20.11
Vary the snapshots by minor version were appropriate.
2024-01-28 21:33:40 +01:00
Mark Wubben
db0fdb2925 Fix 'previous failures' in watch mode always incrementing
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.
2024-01-28 21:33:40 +01:00
Tommy
735bf4172a
Update TypeScript recipe to suggest --import flag and tsimp 2024-01-28 20:46:46 +01:00
Mark Wubben
aae39b20ba
6.1.0 2024-01-21 21:03:08 +01:00
Max Isom
c3e2c72e0a
Fix ava/internal ESM type module 2024-01-21 20:54:42 +01:00
Mark Wubben
0a050243ea Implement registerCompletionHandler()
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.
2024-01-11 22:33:57 +00:00
Mark Wubben
cc8b839724 Ensure AVA exits with code 1 after an unexpected process.exit() in a test worker
It prints the error, so it should fail as such.
2024-01-11 22:33:57 +00:00
Mark Wubben
35f6c86bcd Fix potential bug with watch mode when no failed test files are written
Don't emit the 'touched-files' event, since the watcher assumes that comes with a files value.

Fixes #3285
2024-01-11 22:33:27 +00:00
Mark Wubben
fde8671abd Test with AVA 6 2024-01-11 20:56:28 +00:00
Mark Wubben
808a5613c9 Change recursive watch mode test detection to be non-persistent
Otherwise, on Linux, it seems the abort signal is disregarded.
2024-01-11 20:56:28 +00:00
Mark Wubben
70a6e257b3 Ensure watcher tests exit cleanly
Always await the last pending state when the watch runs have completed.

Use a teardown hook to ensure the watcher is aborted and has exited before ending the test.

Ensure the item is always an object, even if it didn't come from the generator.
2024-01-11 20:56:28 +00:00
Mark Wubben
783f62b94d
Only test reporters on Linux (CI)
These tests are more likely to be flaky on Mac and Windows.
2023-12-30 21:21:43 +01:00
Mark Wubben
9f3bf7e4d3
Remove references to older AVA versions
* 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
2023-12-30 20:58:44 +01:00
Christian Rackerseder
316ffe12cf
Fix typo in README 2023-12-20 17:49:42 +01:00
Mark Wubben
5975b602b7
6.0.1 2023-12-06 22:19:04 +01:00
Mark Wubben
32f282fc21
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
2023-12-06 22:18:23 +01:00
Mark Wubben
cf7a2886bf
6.0.0 2023-12-04 22:31:38 +01:00
Mark Wubben
af5684dff5
Don't force-exit after tests have completed
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.
2023-12-04 22:22:11 +01:00
Mark Wubben
88e433376a
Update dependencies & other minor tweaks
* 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.
2023-12-04 21:56:22 +01:00
Mark Wubben
cac1d1fe64
Tweak README
* Clarify why we've posted the Ukraine war CTA and remove the third-party banner

* Remove Twitter link

It's not the best place to get updates.

* Thread isolation, not process (at least by default)

* Fix link

* Remove outdated comparison with mocha/tape/tap
2023-12-04 21:54:07 +01:00
Mark Wubben
0492d32863 Fix external assertions tests for Node.js 21
The assertion message is different, which requires more creativity with the snapshots.
2023-12-03 22:18:48 +01:00
Max Isom
adbfcde981
Experimentally expose internal events for custom reporters
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.
2023-11-26 21:26:34 +01:00
Sindre Sorhus
6790d50202
Update memoize dependency 2023-11-26 20:55:33 +01:00
Mark Wubben
e07179bf4a
Remove ability to select AVA 5 watcher
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.
2023-11-07 11:52:59 +01:00
Sindre Sorhus
cf0fa4ce5a
Update dependencies, rely on Node.js 18, other small changes
* 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>
2023-11-06 21:46:04 +01:00
Mark Wubben
03a6723a11
Drop Node.js 16, upgrade minimal 18 and 20, test 21
* 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.
2023-10-23 13:56:52 +02:00
Mark Wubben
b6fbd5847a Make assertions throw
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.
2023-10-22 21:40:24 +02:00
Mark Wubben
c792f1048a Fix type tests for t.assert() 2023-10-22 21:40:24 +02:00
Bryan Ricker
0d7bbd5ea4
Fix typo in common pitfalls doc 2023-09-24 16:19:05 +02:00
Aditya Subramanian
e81f413f5a
Allow throws / throwsAsync to work with any value, not just errors
Fixes #2517.

Co-authored-by: Mark Wubben <mark@novemberborn.net>
2023-09-11 13:12:20 +02:00
Mark Wubben
4c5b46981a Refactor error processing
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
2023-09-10 15:26:35 +02:00
Zachary Haber
e27183a9e8
Make assert, truthy and falsy typeguards
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
2023-08-16 20:48:14 +02:00