Commit graph

576 commits

Author SHA1 Message Date
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
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
Mark Wubben
e58f466cc0
Only treat native errors as errors
* 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.
2023-07-31 09:25:50 +02:00
Mark Wubben
f047694d86 Remove p-event dependency 2023-07-03 17:48:48 +02:00
Mark Wubben
5a9a6271c0 Make test-types work with tsc and XO
This used to work… but didn't for the new timout tests.
2023-07-03 15:46:29 +02:00
Mark Wubben
abd43d1f8e Update dependencies 2023-07-02 17:26:14 +02:00
Mark Wubben
e24cdb6eb8 Expect TypeScript 5.1 (or newer)
XO isn't ready for this but it works, just some warnings locally during npm install.
2023-07-02 17:26:14 +02:00
Mark Wubben
6cc417bb42 Set up CI to test the new watcher
* Run tests on macOS
* Use Bash shell
* Run watch mode test separately and serially
2023-07-02 15:14:36 +02:00
Mark Wubben
4f52a9f1d3 Add a brand new watcher
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.
2023-07-02 15:14:36 +02:00
Mark Wubben
13f7451fd4 Require opt-in to AVA 5's watcher and separate install of chokidar
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.
2023-07-02 15:14:36 +02:00
Mark Wubben
6f62c2d51c Remove superfluous dependencies
* Remove get-stream dependency
* Remove delay dependency
* Remove fs-extra
* Remove temp-write
2023-06-25 15:23:04 +02:00
Mark Wubben
fae3f8734f Use ES2022 APIs
* Use Object.hasOwn() instead of Reflect.has()
* Use Object.hasOwn() over Object.prototype.hasOwnProperty()
* Use String#replaceAll()
2023-06-25 15:23:04 +02:00
Mark Wubben
8f1d308a29 Drop support for Node.js 14, update minimal requirements for 16, 18 and 20
Require the latest versions with new features.
2023-06-21 18:02:15 +02:00
Mark Wubben
306e37c3d8
5.3.1 2023-06-16 18:41:14 +02:00
Mark Wubben
568fe40c98
5.3.0 2023-05-25 09:01:26 +02:00
Mark Wubben
784ca4c381
Dependency updates and so forth
* 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
2023-05-24 16:58:05 +02:00
Irven Aelbrecht
555836793c
Recognize typical assertion errors and use their formatting
Co-authored-by: Mark Wubben <mark@novemberborn.net>
2023-05-24 15:18:35 +02:00
Craig Hobbs
faa965474d
Replace 'del' dependency by built-in recursive fs.rm (#3198)
Co-authored-by: Mark Wubben <mark@novemberborn.net>
2023-05-24 15:17:42 +02:00
Mark Wubben
1353b08ae5
5.2.0 2023-02-06 21:41:06 +01:00
Mark Wubben
c74934853d
5.1.1 2023-01-15 22:00:15 +01:00
Mark Wubben
da3d2bcffb
Update dependencies and such
* 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
2023-01-15 21:33:33 +01:00
Mark Wubben
4ecfe7d822
5.1.0 2022-11-14 15:09:48 +01:00
Mark Wubben
609b307a2e
Update dependencies
* Update dev dependencies

* Update dependencies

* Rebuild package-lock
2022-11-14 14:37:44 +01:00
Mark Wubben
7007f13411
5.0.1 2022-09-25 17:08:51 +02:00
Mark Wubben
48dcafa2b8
Update dependencies; more type tweaks
* Upgrade to TypeScript 4.8. Keep testing with 4.7 to ensure backwards compatibility.
* Update dev dependencies
* Update dependencies
* Tweak type definitions used in exports map for TS 4.8 compatibility. Duplicate and export shared types where appropriate, but don't export from the other export file since it seems to confuse things.
2022-09-25 17:06:16 +02:00
Mark Wubben
3ebe65cbeb
Re-organize types for maximum compatibility
Add shims for TypeScript's 'node' module resolution algorithm. The exports map is only used with the `node16` algorithm.

Write types in CommonJS, so they can be exported from ESM files. The other way around is prone to, at the very least, confusing warnings.
2022-09-25 16:31:54 +02:00
Mark Wubben
d84dbc1c8c
5.0.0 2022-09-04 16:57:48 +02:00
Mark Wubben
02f626f529
Update dependencies
Exclude Acorn stack traces from reporter logs.

Export types not interfaces.
2022-08-26 16:59:40 +02:00
Mark Wubben
14061be6be
Merge branch 'v4-hotfix' 2022-08-26 14:49:12 +02:00
Mark Wubben
7c48c4d919
Update to node@18.8 and npm@8.18 and fix test suite 2022-08-25 16:15:10 +02:00
Mark Wubben
a1347a58f3
4.3.3 2022-08-25 15:20:55 +02:00
Mark Wubben
6d93de5285
4.3.2 2022-08-25 15:04:34 +02:00
Mark Wubben
fd7f0ed776 Require Node.js 14.19, 16.15 or 18 2022-07-10 18:46:32 +02:00
Mark Wubben
02f4e27b53
Rely on TypeScript 4.7 and update integration + tests
* Only test against TypeScript 4.7

* Move type definitions to entrypoints/

Only TS 4.7 will resolve them now, but it's cleaner.

* Use @sindresorhus/tsconfig

* Fix test TypeScript files, make compilable and lintable

* Use tsc directly, instead of tsd

* Add *.cts versions of type tests

* Reorganize type tests

* Use tsc directly, avoid npx, print actual version

Somehow `npx tsc` was pointing at an older version. Possibly the binstubs are corrupted in CI… somehow.
2022-07-10 18:30:04 +02:00
Mark Wubben
53e570998b
4.3.1 2022-07-10 18:25:48 +02:00
Mark Wubben
a24dc9b4e7
4.3.0 2022-06-02 16:37:19 +02:00
Mark Wubben
6240393375
Assorted updates
* Remove Node.js 17 support
* Add Node.js 18 support
* Use latest everything for CI tasks
* Configure Volta for managing development versions
* Update dependencies
2022-06-02 15:03:45 +02:00
Rebecca Stevens
c218a210a1
Fix TS 4.7 compatibility
Export type definitions for CJS imports, make the existing ESM definitions discoverable by TS 4.7.

Co-authored-by: Mark Wubben <mark@novemberborn.net>
2022-06-02 14:04:40 +02:00
Mark Wubben
843644b10f
4.2.0 2022-04-10 18:53:51 +02:00
Mark Wubben
4f14c6b6db
4.1.0 2022-03-06 17:00:42 +01:00
Mark Wubben
419047b8ff
Update dependencies
* Update dev dependencies

* Update dependencies

* Remove concurrency limit for internal tests

* Test with TypeScript 4.6

* Update XO and fix formatting
2022-03-06 16:52:21 +01:00
Mark Wubben
6b63b1bc14
4.0.1 2022-01-08 15:14:12 +01:00
Mark Wubben
9bc615e2c9
4.0.0 2022-01-03 18:49:22 +01:00
Mark Wubben
0187779a0b
Dependency updates
* Fix reference to chalk's color level

* Upgrade XO and reformat

* Update dev dependencies

* Update production dependencies

* Rebuild lockfile

* CI: Continue when 'npm ls' errors in TypeScript compatibility job
2022-01-02 19:38:30 +01:00
Mickey Rose
bedd1d04c5
Remove dependency on equal-length
Co-authored-by: Mark Wubben <mark@novemberborn.net>
2021-12-31 18:09:04 +01:00
Mark Wubben
5cdeb9d44c
4.0.0-rc.1 2021-11-01 17:54:57 +01:00