Skip to content

Commit 136eac5

Browse files
committed
Update documentation
1 parent b31b242 commit 136eac5

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This is designed to work for projects that precompile TypeScript. It allows AVA
66

77
In other words, say you have a test file at `src/test.ts`. You've configured TypeScript to output to `build/`. Using `@ava/typescript` you can run the test using `npx ava src/test.ts`.
88

9+
Compatible with AVA 6, 7 and 8. Requires Node.js 22.20, 24.12 or 25 (or newer).
10+
911
## Enabling TypeScript support
1012

1113
Add this package to your project:
@@ -37,11 +39,15 @@ You can enable compilation via the `compile` property. If `false`, AVA will assu
3739

3840
Output files are expected to have the `.js` extension.
3941

40-
AVA searches your entire project for `*.js`, `*.cjs`, `*.mjs`, `*.ts`, `*.cts` and `*.mts` files (or other extensions you've configured). It will ignore such files found in the `rewritePaths` targets (e.g. `build/`). If you use more specific paths, for instance `build/main/`, you may need to change AVA's `files` configuration to ignore other directories.
42+
AVA searches your entire project for `*.js`, `*.mjs`, `*.ts` and `*.mts` files﹡ (or other extensions you've configured). It will ignore such files found in the `rewritePaths` targets (e.g. `build/`). If you use more specific paths, for instance `build/main/`, you may need to change AVA's `files` configuration to ignore other directories.
43+
44+
﹡ AVA 6 and 7 will also search for `*.cjs` and `*.cts` files.
4145

4246
## ES Modules
4347

44-
If your `package.json` has configured `"type": "module"`, or you've configured AVA to treat the `js` extension as `module`, then `@ava/typescript` will import the output file as an ES module. Note that this is based on the *output file*, not the `ts` extension.
48+
With AVA 6 and 7, if your `package.json` has configured `"type": "module"`, or you've configured AVA to treat the `js` extension as `module`, then `@ava/typescript` will import the output file as an ES module. Note that this is based on the _output file_, not the `ts` extension.
49+
50+
AVA 8 will _always_ import all files as ES modules.
4551

4652
## Add additional extensions
4753

@@ -53,10 +59,7 @@ You can configure AVA to recognize additional file extensions. To add (partial
5359
{
5460
"ava": {
5561
"typescript": {
56-
"extensions": [
57-
"ts",
58-
"tsx"
59-
],
62+
"extensions": ["ts", "tsx"],
6063
"rewritePaths": {
6164
"src/": "build/"
6265
}
@@ -69,4 +72,4 @@ If you use the [`allowJs` TypeScript option](https://www.typescriptlang.org/tsco
6972

7073
See also AVA's [`extensions` option](https://github.com/avajs/ava/blob/master/docs/06-configuration.md#options).
7174

72-
† Note that the [*preserve* mode for JSX](https://www.typescriptlang.org/docs/handbook/jsx.html) is not (yet) supported.
75+
† Note that the [_preserve_ mode for JSX](https://www.typescriptlang.org/docs/handbook/jsx.html) is not (yet) supported.

0 commit comments

Comments
 (0)