-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code coverage breaks in parallel mode #374
Comments
@eye1 could you provide a minimal example that fails in a repository? c8 itself uses mocha, and is tested with [email protected]. |
@eye1 if you're continuing to bump into issues, and can provide an example, please let me know. Closing for now. |
I've got a similar result but with a different trigger. In my case setting mocha's Stable workaround appears to be to remove the In my case I've got a monorepo using NX. NX will run the test suites for each package independently and in parallel on a multicore/cpu machine. However you don't need a monorepo or NX to reproduce what I'm observing. Here I demonstrate using GNU Parallel: parallel \
--tag \
'
cd packages/{1} \
&& npx c8 \
--config ../../.c8rc.json \
--report-dir "../../.coverage/report/{1}" \
--temp-directory "../../.coverage/temp/{1}" \
ts-mocha \
--config ../../.mocharc.cjs \
-- \
"**/*.test.ts" \
;
' \
::: \
package1 \
package2 \
&& echo "Passed" \
|| echo "Failed" \
; Assuming you have a folder structure like as follows:
With actual NPM-based Typescript repositories checked out in the Here are the config file contents:
|
I was able to find a workaround myself. By setting lowering number of jobs as to how many are used by default seems to fix the issue and code coverage works fine. |
When adding
--parallel
to this command:"test": "NODE_ENV=test mocha \"test/**/*.test.js\" --parallel --timeout 10000 --exit --require test/setup.mjs",
code coverage report seems to only receive partial data
small excerpt in a much longer report:
"mocha": "9.1.4"
If I upgrade to mocha 9.2.0 then it does not work even without parallel and the report becomes empty.
The text was updated successfully, but these errors were encountered: