I've updated to latest version due to #132 which supposedly fixes issues with my project like #104), but now I can't even generate any coverage. The process fails with errors.
Under my app source code folder I have a typings folder where I place custom *.d.ts files so that TypeScript finds all the types for my code. I currently have 3 of these *.d.ts files and generating coverage with ts-jest is giving me 3 errors on these 3 files, something like this:
Failed to collect coverage from C:\MyProject\app\typings\files.d.ts
ERROR: Error: Debug Failure. False expression: Output generation failed
STACK: Error: Debug Failure. False expression: Output generation failed
at Object.assert (C:\MyProject\node_modules\typescript\lib\typescript.js:3259:23)
at Object.transpileModule (C:\MyProject\node_modules\typescript\lib\typescript.js:76181:18)
at Object.process (C:\MyProject\node_modules\ts-jest\dist\preprocessor.js:16:30)
at Function.transformSource (C:\MyProject\node_modules\jest-runtime\build\transform.js:282:24)
at transformSource (C:\MyProject\node_modules\jest-runtime\build\index.js:159:22)
at module.exports (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\generateEmptyCoverage.js:23:14)
at files.forEach.e (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\reporters\CoverageReporter.js:102:30)
at Set.forEach (native)
at CoverageReporter._addUntestedFiles (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\reporters\CoverageReporter.js:98:13)
at CoverageReporter.onRunComplete (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\reporters\CoverageReporter.js:56:10)
Failed to collect coverage from C:\MyProject\app\typings\twilio.d.ts
ERROR: Error: Debug Failure. False expression: Output generation failed
STACK: Error: Debug Failure. False expression: Output generation failed
at Object.assert (C:\MyProject\node_modules\typescript\lib\typescript.js:3259:23)
at Object.transpileModule (C:\MyProject\node_modules\typescript\lib\typescript.js:76181:18)
at Object.process (C:\MyProject\node_modules\ts-jest\dist\preprocessor.js:16:30)
at Function.transformSource (C:\MyProject\node_modules\jest-runtime\build\transform.js:282:24)
at transformSource (C:\MyProject\node_modules\jest-runtime\build\index.js:159:22)
at module.exports (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\generateEmptyCoverage.js:23:14)
at files.forEach.e (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\reporters\CoverageReporter.js:102:30)
at Set.forEach (native)
at CoverageReporter._addUntestedFiles (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\reporters\CoverageReporter.js:98:13)
at CoverageReporter.onRunComplete (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\reporters\CoverageReporter.js:56:10)
Failed to collect coverage from C:\MyProject\app\typings\globals.d.ts
ERROR: Error: Debug Failure. False expression: Output generation failed
STACK: Error: Debug Failure. False expression: Output generation failed
at Object.assert (C:\MyProject\node_modules\typescript\lib\typescript.js:3259:23)
at Object.transpileModule (C:\MyProject\node_modules\typescript\lib\typescript.js:76181:18)
at Object.process (C:\MyProject\node_modules\ts-jest\dist\preprocessor.js:16:30)
at Function.transformSource (C:\MyProject\node_modules\jest-runtime\build\transform.js:282:24)
at transformSource (C:\MyProject\node_modules\jest-runtime\build\index.js:159:22)
at module.exports (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\generateEmptyCoverage.js:23:14)
at files.forEach.e (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\reporters\CoverageReporter.js:102:30)
at Set.forEach (native)
at CoverageReporter._addUntestedFiles (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\reporters\CoverageReporter.js:98:13)
at CoverageReporter.onRunComplete (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\reporters\CoverageReporter.js:56:10)
In the end I get this:
Ran all test suites.
Error: ENOENT: no such file or directory, scandir 'C:\Users\Amaral\AppData\Local\Temp\jest\ts-jest'
at Error (native)
at Object.fs.readdirSync (fs.js:951:18)
at processResult (C:\MyProject\node_modules\ts-jest\dist\coverageprocessor.js:20:26)
at source.getTestPaths.then.then.then.runResults (C:\MyProject\node_modules\jest\node_modules\jest-cli\build\runJest.js:110:58)
at process._tickCallback (internal/process/next_tick.js:103:7)
npm ERR! Test failed. See above for more details.
I don't have a minimal repo working not even a public one, sorry. But I can provide access to the private project where I'm having this issue if needed.
But I can provide access to the private project where I'm having this issue if needed.
That would be useful to debug this
@kulshekhar Just added you as a collaborator to the project. Please look into the ts-jest branch :)
@rfgamaral thanks. I ran a quick test and it seems that the only tests that are failing are failing due to path separator mismatch. Should I post the log here?
I've added a new file (tsjest-log.txt) in the ts-jest branch with the logs
@kulshekhar That's a different issue which I have yet to understand why it happens because it doesn't happen all the time.
Try to run npm test -- --coverage, that will give you the errors I mentioned above. Sorry, should have mentioned this before.
That's a different issue which I have yet to understand why it happens because it doesn't happen all the time.
That's probably caused due to different path separators on Windows & Linux
Try to run npm test -- --coverage, that will give you the errors I mentioned above. Sorry, should have mentioned this before.
I was able to replicate this issue. The solution was to ignore the typings folder. I've updated the ts-jest branch. Try giving it a shot now
Yep, that was it. Thanks very much for your help :)
I am facing the same issue .. How can we ignore the typings folder?
Same issue for me for any type declaration (d.ts)
I need to add "coveragePathIgnorePatterns": [".*\\.d\\.ts", "<rootDir>/node_modules/"]
You might also need to use modulePathIgnorePatterns for the same issue when running tests.
Most helpful comment
Same issue for me for any type declaration (d.ts)
I need to add
"coveragePathIgnorePatterns": [".*\\.d\\.ts", "<rootDir>/node_modules/"]