Description
Hi, for some reason we have performance problems when using ts-node in our mocha tests. It takes about 500 ms to compile an empty ts file. I added some console.logs to measure the time to run this very line: const output = service.getEmitOutput(fileName)
and this line takes 500 ms to run even though the content of the file is an empty string (the code
variable on the line 314 is empty string). Actually, all our tests files take too long to process, while the production files take a few milliseconds to compile. So any *.spec.ts
takes about 500 ms to compile, a regular *.ts
file takes about 20 ms. Do you have any idea what could be the root cause or how should I debug it more?
We use latest mocha, ts-node and typescript, but we tried some old versions too and the problem persists. The tsconfig.json
:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "dist",
"rootDir": ".",
"declaration": true,
"target": "es2017",
"lib": ["es2017"],
"module": "commonjs",
"moduleResolution": "node"
},
"exclude": [
"node_modules",
"dist"
]
}