-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
nyc reports no coverage in parallel mode in powershell/cmd #4372
Comments
Hi, But when running |
I can confirm I have this issue as well. My setup is with pnpm + typescript, and while I have to run nyc with Env: Windows 10 " module.exports = {
checkLeaks: true,
diff: true,
color: true,
extension: ["ts"],
growl: false,
reporter: "spec",
recursive: false,
require: ["ts-node/register"],
spec: "test/**/*.spec.ts",
slow: 500,
// parallel: !process.env.CI,
}; |
I'm running into this as well. Has anybody found a temporary workaround? |
I disable parallel mode in coverage test.
|
I'm not sure whether it is mocha's bug. I tested it with hexo@ Results are different base on hexo's test suites. I did dig hexo source code, but I didn't find what affect coverage. test/scripts/console/index.js
test/scripts/extend/index.js
|
need to find the root cause here... I'll take a look at this today. I'll be using |
@mdrichardson Running |
@boneskull Ooooh, that's interesting. I tried it again a couple of weeks ago with the latest mocha/nyc at the time and it didn't work. |
tbh I'm a little confused about the monorepo setup. how to upgrade mocha on all the subpackages? I also note that nyc is present in the subpackages' package.json but not the monorepo package.json |
@boneskull I just did a find/replace w/ regex, as I recall. |
wow. this was fixed by the upgrade to (@mdrichardson mind you, in so |
closed by #4465 |
@boneskull Awesome. Nice find! ...and yeah, I'm aware of the weirdness ;) |
@mdrichardson you may want to |
@boneskull Will do. I believe the event listeners piece, at least is unrelated to mocha |
@boneskull I still don't seem to get coverage reporting with
Am I missing something? |
@mdrichardson I'll take a look |
|
@boneskull Alright, I'll give that a go. Thanks again!!!! |
I can't make it break... maybe there's something else about your setup. what node/npm version, os? |
Yeah, I suspected it could be something like that. Testing now, but:
|
@boneskull Hmm...I tried everything again w/ Node v12.16.1 (original), v12.19.0, and v15.0.0 (and relevant npm version) and still don't get the coverage report. I also went in and deleted I know if you can't repro, it's pretty much impossible for you to do much about it. Any troubleshooting steps you'd recommend on my end? |
I'll try it on Windows. using powershell or something else? |
I was using command prompt, but I'll try bash and powershell |
@boneskull Worked in bash, but not command prompt or Powershell |
OK, that's good to know. I can reproduce in Powershell. is the problem mocha's or nyc's? hmmm... |
I've narrowed it down; see https://github.com/boneskull/mocha-nyc-parallel-issue and the README there
All three methods in that repo work on my mac, but only the last one (using |
OK, I've updated the |
I'll send a PR to |
also see istanbuljs/nyc#762 |
Hi @boneskull, since the fix in Thanks! |
The unnecessary test fails in environments where mbt is installed, and it only passed because the check for mbt existance returned false. Coverage does not work on Windows when Mocha runs in parallel: mochajs/mocha#4372
- Issues in mta.yaml are now marked as errors - Path validation is removed (since the path can be created during the build) - Yaml syntax highlighting for mtaext files Fix: - mta executable is downloaded if not available for the purpose of validations (it's still required for generators) Tests: - Remove unnecessary test (it failed in environments where mbt is installed) - Add new test - Fix coverage on windows (coverage does not work on Windows when mocha runs in parallel: mochajs/mocha#4372)
The fix in |
mochajs/mocha#4372 was fixed in mocha@8.3.0 by requiring workerpool@6.1.0, allowing --parallel to be used during coverage collection again. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Cross-posting istanbuljs/nyc#1328 here.
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Link to bug demonstration repository
hexojs/hexo#4374
Expected Behavior
nyc --reporter=lcovonly mocha --parallel
should produce "./coverage/lcov.info".nyc --reporter=text-summary mocha --parallel
should display coverage report.Observed Behavior
nyc --reporter=lcovonly mocha --parallel
generates an empty "./coverage/lcov.info".nyc --reporter=text-summary mocha --parallel
:Troubleshooting steps
No issue in mocha's default serial mode.
Environment Information
Reproduces how often: [What percentage of the time does it reproduce?] 100%
Versions
mocha --version
andnode node_modules/.bin/mocha --version
: 8.0.1 & 8.0.1node --version
: v12.18.0Additional Information
".mocharc.yml"
The text was updated successfully, but these errors were encountered: