-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
What you're trying to do
Great tool, though we're having a problem in some of our projects that rely on ts-node loader. We know there's a timeout (or JS OOM error depending on file) but we don't know why without thorough investigation. We are following Typescript recipe in docs/recipes/typescript.md and using native ESM modules.
What happened
When there is a type issue in a test, adding number of lines to that test file appears to exponentially affect memory usage and test time.
What you expected to happen
Test(s) fails
I am testing this on my Macbook Air M1. I have tested with Node 18.12.0 and Node 16.17.
Minimal Reproduction:
package.json
{
"name": "ava-repro",
"scripts": {
"test": "ava --config ava.config.js spec.ts"
},
"type": "module",
"dependencies": {
"ava": "^5.0.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
}
}ava.config.js
export default {
concurrency: 1,
timeout: '120s',
nodeArguments: ['--loader=ts-node/esm'],
extensions: { ts: 'module', },
};tsconfig.js
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node"
},
"exclude": ["node_modules"]
}working.spec.ts
import test, { ExecutionContext } from 'ava';
test.skip('broken test', (t: ExecutionContext) => {
const test = 1;
console.log(test + 1)
broken() // reference error, does not pass ts compilation
});
broken.spec.ts
import test, { ExecutionContext } from 'ava';
test.skip('broken test', (t: ExecutionContext) => {
const test = 1;
console.log(test + 1)
console.log(test + 1)
console.log(test + 1)
console.log(test + 1)
console.log(test + 1) // test time & memory usage starts to increase dramatically when i add about 6
console.log(test + 1) // gets exponentially worse the more of these you add
console.log(test + 1) // oom errors around 7 or so extra lines
console.log(test + 1) // they can be in the same test or in others in the same file
broken() // the reference error that causes the issue
});