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: 1 comment 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.
Currently Vitest does not intercept
require()
calls thatts-node
hooks into. It should be possible to implement a require hook for Istanbul instrumentation so that code that is not run throughvite-node
could 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_process
here: 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?