Custom loader not called on node 20 #3213
Replies: 5 comments 17 replies
-
I reckon the problem is somewhere between Node.js, the loader and the configuration; not AVA itself. One possibility is that with your configuration ( |
Beta Was this translation helpful? Give feedback.
-
Running into the same issue which only repros on Node.js v20. Here's a workaround, but something changed between Node v19 and v20 which is causing this. |
Beta Was this translation helpful? Give feedback.
-
I managed to get it to work, but it is weird: // ava.config.js
export default {
extensions: {
js: true,
ts: 'commonjs' // but still write your tests in esm
}
} npx tsx node_modules/.bin/ava For some reason I'm guessing tsx is transpiling to cjs which is why I wish this wasn't the solution 😅 |
Beta Was this translation helpful? Give feedback.
-
@Sparticuz fyi TSX is on esbuild, so doesn't support decorators hence TypeORM and MikroORM. |
Beta Was this translation helpful? Give feedback.
-
I switched my CI to use node 19.x as a quickfix |
Beta Was this translation helpful? Give feedback.
-
Please provide details about:
Load a typescript test file
the typescript loader to be called and handeling the file
Please share relevant sample code. Or better yet, provide a link to a minimal reproducible example.
We'll also need your AVA configuration (in
package.json
orava.config.*
configuration files) and how you're invoking AVA. Share the installed AVA version (get it by runningnpx ava --version
)."ava": {
"extensions": {
"ts": "module"
},
"nodeArguments": [
"--loader=tsx"
]
}
node version 20.3.0 ava verison 5.3.0
Beta Was this translation helpful? Give feedback.
All reactions