Instrument spawned processes with ts-node #2911
-
|
Can Vitest instrument The use case is integration testing for CLI applications. I recently swapped from mocha-chai to Vitest and the coverage half-worked. vitest config: Previously, those with 100% branch coverage had 100% coverage for other columns too. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Currently Vitest does not intercept But I'm not sure if it can "see" processes launched by |
Beta Was this translation helpful? Give feedback.
-
|
See #7064 |
Beta Was this translation helpful? Give feedback.

Currently Vitest does not intercept
require()calls thatts-nodehooks into. It should be possible to implement a require hook for Istanbul instrumentation so that code that is not run throughvite-nodecould be included in code coverage.But I'm not sure if it can "see" processes launched by
child_process.spawn. There's nothing about patchingchild_processhere: https://github.com/istanbuljs/istanbuljs/blob/fb8cb4bb99c9e5d36c8b011338d2ab5d3c72ff9c/packages/istanbul-lib-hook/lib/hook.js#L229-L236Could you provide small example of this so that I could test it?