Skip to content

Commit 0574e5e

Browse files
author
Martynas Žilinskas
authored
Add t-node error handling section to TypeScript recipe
1 parent 1c56764 commit 0574e5e

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docs/recipes/typescript.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,25 @@ If your `package.json` does not have `"type": "module"`, then this is the AVA co
7676
}
7777
```
7878

79-
It's worth noting that with this configuration, tests will fail if there are TypeScript build errors. If you want to test while ignoring these errors you can use `ts-node/register/transpile-only` instead of `ts-node/register`.
79+
It's worth noting that with this configuration, tests will fail if there are TypeScript build errors. Suppose you want to test while ignoring these errors. In that case, you can use `ts-node/register/transpile-only` instead of `ts-node/register` or add an environment variable for ts-node to log errors to stderr instead of throwing an exception.
80+
81+
`package.json`:
82+
83+
```json
84+
{
85+
"ava": {
86+
"extensions": [
87+
"ts"
88+
],
89+
"environmentVariables": {
90+
"TS_NODE_LOG_ERROR": "true"
91+
},
92+
"require": [
93+
"ts-node/register"
94+
]
95+
}
96+
}
97+
```
8098

8199
## Writing tests
82100

0 commit comments

Comments
 (0)