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

Update README.md #51

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Adds [TypeScript](https://www.typescriptlang.org/) support to [AVA](https://avaj

This is designed to work for projects that precompile TypeScript. It allows AVA to load the compiled JavaScript, while configuring AVA to treat the TypeScript files as test files.

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`.
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` and ava will pretend that the test came from the typescript file.

## Enabling TypeScript support

Expand All @@ -30,8 +30,7 @@ Then, enable TypeScript support either in `package.json` or `ava.config.*`:
}
}
```

Both keys and values of the `rewritePaths` object must end with a `/`. Paths are relative to your project directory.
As configured above, the "rewritePaths" option means that AVA's internal representation of the paths will be changed from "src/" to "build/" (note that the key and value must end in a "/"). Paths are relative to your project directory.

You can enable compilation via the `compile` property. If `false`, AVA will assume you have already compiled your project. If set to `'tsc'`, AVA will run the TypeScript compiler before running your tests. This can be inefficient when using AVA in watch mode.

Expand Down