bcoe / bcoe/c8

Watching child process

Open
#421 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
2.1k
Forks
99
PR merge metrics
No merged PRs in 30d

Description

Hi guys,

I have a project with Vue.js + Typescript + Mocha that I need to generate code coverage from. I was using nyc + istanbul before, but had the issue with ESM modules, so I switched to c8 but I have an issue that when running tests, there are several child processes started and c8 lost track of it.

Vue-cli is triggering new process with mochapack which triggers new process with webpack which triggers new process with typescript and mocha (at least this is how I understand it :)).

I tried to exclude as many process from this chain as possible and ended with following command:

```
cross-env MODE=test NODE_ENV=test c8 ./node_modules/.bin/mochapack --recursive --require ./node_modules/@vue/cli-plugin-unit-mocha/setup.js --webpack-config ./node_modules/@vue/cli-service/webpack.confi
g.js 'src/**/analytics.spec.ts'
```

This runs c8 that runs mochapack that runs webpack that runs typescript and then mocha. In the coverage output generated by c8 I can see my config files that are used by webpack being stated with coverage included but no test files. Clearly test files are run by child process and therefore not shown in output.

TLDR:
Is there any way to watch for child processes with c8 too?
Or are you aware of any other solution (i.e command webpack to run c8 before running typescript & mocha)?

Thanks :)

* **C8 Version**: 7.12.0
* **Node Version**: 14.19.0
* **Platform**: Windows 11 64bit

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.