Closed DWboutin closed 6 years ago
Could you link a repo which demonstrates this issue? Maybe a branch on nextjs-redux-boilerplate?
I suspect AppMenu.jsx is reporting 100% branch coverage means that source has no branches.
The repo is private sadly, on bitbucket :(
What do you mean "has no branches"? No Git branch? It has a git branch, that's sure.
Thank you for your help! If I can provide you anything, I will, but I can't let you access directly the repo.
I was referring to 'execution branches'. For example:
if (someConditional) {
console.log('The if statement is two branchs - one for true and one for false.');
}
The code which is showing 100% coverage of branches doesn't have any branches so istanbul is reporting 100% (0 out of 0) are covered. Maybe this could be better to report as N/A for those cases but that's a separate question.
I don't need or want access to the real repo, I'm looking for a basic example repo. Something which demonstrates running a similar test and getting similar lack of coverage. What I do need to see is how you are testing these sources with 0% coverage. For example are those sources being tested directly inside node or are they being loaded in a browser?
I created this repo https://github.com/DWboutin/nyc-help. It's a frontend app.
Thank you so much for your help!
I found issues in your nyc-help repo which caused your issues. Both in package.json under the "nyc" section.
"extension": [".js", ".jsx"]
. See section in readme"compilers"
option entirely. You are telling mocha running that so I think this was causing it to run twice.Once I changed the extensions I was getting better results but still not fully correct. Once I removed the "compilers" option from nyc I got what looks correct to me (obviously I don't know your project).
I'll try this this weekend! Thanks a lot for your help! I'm really noob with tests and coverage.
Do you know a good tutorial who teach how to build a stack like mine?
I'm not sure about specific to your stack but lots of good information including some tutorials at https://istanbul.js.org/. Also an #istanbuljs
channel on slack at http://devtoolscommunity.herokuapp.com/.
Sounds like this issue can be closed, and more specific questions can come up in the slack channel or as new issues? :)
Yes it can be closed! Thank you so much for your help!!!
Expected Behavior
Cover all files correctly
Observed Behavior
Some covering are at 0% while the tests are complete
Bonus Points! Code (or Repository) that Reproduces Issue
Forensic Information
Node v8.10.0 NPM 5.6.0 Operating System: the operating system you observed the issue on. Environment Information: information about your project's environment, see instructions below:
sh -c 'node --version; npm --version; npm ls' > output.txt
My codecoverage do this:
Lots of 0 when the tests cover all. Like
AppMenu.jsx
have a 100, butAppHeader.jsx
have 0 everywhere but it's covered.https://gist.github.com/DWboutin/24ee23d185a370ffa8c39acfee4af823
This is my package.json: https://gist.github.com/DWboutin/24ee23d185a370ffa8c39acfee4af823
This is the base boilerplate of my project https://github.com/DWboutin/nextjs-redux-boilerplate
Thank you