You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@rwwagner90 I mean, something like instanbul check coverage functionality, where if your current coverage doesn't comply with the expected coverage your build breaks :)
@jonathansamines I think we can configure istanbul more directly now, so this might be possible with the latest versions. Do you have any interest in trying to figure it out? I generally just enforce coverage thresholds with Code Climate, Coveralls, etc.
Not checked which fields of.istanbul.yml would work. You could also do nyc check-coverage --lines 95 --functions 95 --branches 95 in your posttest script.
Not checked which fields of .istanbul.yml would work.
Have checked this, the check.istanbul.yml fields don't work - in the long run we should probably fix this, but it wont work in the short run.
You could also do nyc check-coverage --lines 95 --functions 95 --branches 95 in your posttest script.
Have tested this, also doesn't work because nyc expects the coverage report to be in a different place/format
The solution that I've tested and works fine is using the istanbul@1 CLI
$ npm install --save-dev istanbul
$ COVERAGE=true ember test
$ istanbul check-coverage --statements=100 --functions=100 --branches=100 --lines=100 coverage/coverage-final.json
You probably need to make sure you use the json reporter so that you get a coverage-final.json file in your coverage folder
@adamjmcgrath with the merge of #169 which said that version works with nyc, can we officially recommend nyc as the method for checking thresholds in the README? Perhaps even offer a config to add nyc and check automatically, failing the Ember build if the threshold is not met?
@adamjmcgrath@charlesdemers would one of you like to document this in the README? I also think it could be nice to add nyc as a dep to this addon, and just build this functionality in. I would like the Ember build to fail, when the coverage is not sufficient, if we can do that. That way, testing locally and on travis are the same.
I think leaving it to the user to add in checking coverage is sufficient. They can change their npm test command to both run tests and check coverage, if they want that. I do think documenting that nyc utils can now be used with this addon is something we should do.
Activity
RobbieTheWagner commentedon Sep 30, 2017
@jonathansamines sorry for the delay in responding, but could you please elaborate 😄
jonathansamines commentedon Oct 2, 2017
@rwwagner90 I mean, something like instanbul check coverage functionality, where if your current coverage doesn't comply with the expected coverage your build breaks :)
RobbieTheWagner commentedon Feb 8, 2018
@jonathansamines I think we can configure istanbul more directly now, so this might be possible with the latest versions. Do you have any interest in trying to figure it out? I generally just enforce coverage thresholds with Code Climate, Coveralls, etc.
adamjmcgrath commentedon Feb 8, 2018
Not checked which fields of
.istanbul.ymlwould work. You could also donyc check-coverage --lines 95 --functions 95 --branches 95in yourposttestscript.adamjmcgrath commentedon Feb 13, 2018
Have checked this, the
check.istanbul.ymlfields don't work - in the long run we should probably fix this, but it wont work in the short run.Have tested this, also doesn't work because
nycexpects the coverage report to be in a different place/formatThe solution that I've tested and works fine is using the istanbul@1 CLI
$ npm install --save-dev istanbul $ COVERAGE=true ember test $ istanbul check-coverage --statements=100 --functions=100 --branches=100 --lines=100 coverage/coverage-final.jsonYou probably need to make sure you use the
jsonreporter so that you get acoverage-final.jsonfile in yourcoveragefolderRobbieTheWagner commentedon Apr 4, 2018
@adamjmcgrath with the merge of #169 which said that version works with nyc, can we officially recommend nyc as the method for checking thresholds in the README? Perhaps even offer a config to add nyc and check automatically, failing the Ember build if the threshold is not met?
adamjmcgrath commentedon Apr 8, 2018
I haven't had an opportunity to try it yet - perhaps @charlesdemers can confirm?
charlesdemers commentedon Apr 8, 2018
Yep it’s possible to fail the build on Travis with
nycnow that #169 is merged, I do it with this config:.nycrc
in package.json:
in .travis.yml
RobbieTheWagner commentedon Apr 9, 2018
@adamjmcgrath @charlesdemers would one of you like to document this in the README? I also think it could be nice to add nyc as a dep to this addon, and just build this functionality in. I would like the Ember build to fail, when the coverage is not sufficient, if we can do that. That way, testing locally and on travis are the same.
kategengler commentedon Apr 11, 2018
I think leaving it to the user to add in checking coverage is sufficient. They can change their
npm testcommand to both run tests and check coverage, if they want that. I do think documenting thatnycutils can now be used with this addon is something we should do.RobbieTheWagner commentedon Apr 11, 2018
Sounds good. @charlesdemers would you mind submitting a PR to document how you use nyc?
charlesdemers commentedon Apr 11, 2018
Sure! I can do it sometime this week :)
RobbieTheWagner commentedon Jun 14, 2020
This probably shouldn't be closed until the PR is either merged or closed.