karma-runner / karma-runner/karma-coverage

ng test --code-coverage fails (while "ng test" is ok)

Open
#460 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
771
Forks
242
PR merge metrics
No merged PRs in 30d

Description

Hi, during exploration of some third party library (swimlane/ngx-charts) i faced with an issue where command "ng test --code-coverage" fails while at the same time command "ng test" works ok. I raised an issue here https://github.com/swimlane/ngx-charts/issues/1709 hoping that library authors already faced with this, but have no reply so far and to be honest it sounds more like an issue in current karma-coverage. In the above link I provided more details. My dev package.json config is as follow:

`
"devDependencies": {
"@angular-devkit/build-angular": "~12.1.2",
"@angular/cli": "~12.1.2",
"@angular/compiler-cli": "~12.1.2",
"@types/clone": "^2.1.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"clone": "^2.1.2",
"codelyzer": "^6.0.2",
"jasmine-core": "^3.7.1",
"jasmine-spec-reporter": "~5.0.0",
"karma": "^6.3.8",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "^2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-sonarqube-unit-reporter": "0.0.23",
"ng-mocks": "^12.5.0",
"protractor": "~7.0.0",
"sonar-scanner": "^3.1.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.3.5"
}
`

Thanks in advance for any help with this
best regards
Darek

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the reported Angular 12 dependency configuration, comparing `ng test --code-coverage` with `ng test`; the linked ngx-charts issue contains the additional details. Trace the coverage path from the `ng test --code-coverage` entry point, and consider the issue done when coverage generation succeeds without breaking ordinary tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript, typescript
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.