Conversation
|
This is great! I'm using it and once I get it all working, I may submit a PR to your PR. One thing though - what about custom Mocks? Would be great to have 1 in there as an example template. |
|
Hey, @lathonez , @morrisonbrett and others... I found this open PR to be incredibly useful in getting test coverage working in my own project. I noticed it has a merge conflict, and rather than trying to do a PR-for-a-PR, I just wanted to mention I fixed the merge conflict locally and it's not difficult. I did this: Make your "scripts": {
...
"test": "karma start ./test-config/karma.conf.js",
"test-ci": "karma start ./test-config/karma.conf.js --single-run",
"e2e": "npm run e2e-update && npm run e2e-test",
"e2e-test": "protractor ./test-config/protractor.conf.js",
"e2e-update": "webdriver-manager update --standalone false --gecko false",
"test-coverage": "karma start ./test-config/karma.conf.js --coverage"
},Then: Again, thanks. This was super useful. Saved me a lot of time. |
|
I think it's worth fixing and merging this PR. If I found it useful, I'm sure others will, too. :) |
|
How do I configure it that I can make the test cases displayed on the command terminal but not browser? |

Followed the instructions on karma-coverage-istanbul-reporter and in particular this example config to add the minimal changes required to get coverage working.
You need an additional webpack loader (istanbul-instrumenter-loader) and to add
karma-coverage-istanbulas a reporter.The reason I've added a separate script in package.json (
test-coverage) is that coverage breaks the sourcemaps: angular/angular-cli#1799 - so you don't want to run it all the time. Either that or you need an explicit debug as the ng-cli team did.