Tests with code coverage fail when using Angular 12.2.10
See original GitHub issueπ Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
While running tests with code coverage ng test --code-coverage=true
Karma fails with error.
Version 12.2.9
doesnβt have this problem.
Description
π¬ Minimal Reproduction
ng test --code-coverage=true
π₯ Exception or Error
./src/app/timesheet/services/timesheet.service.ts - Error: Module build failed (from ./node_modules/@jsdevtools/coverage-istanbul-loader/lib/index.js):
Error: /home/hosuaby/projects/my-timesheet/src/app/timesheet/services/timesheet.service.ts: don't know how to turn this value into a node
at valueToNode (/home/hosuaby/projects/my-timesheet/node_modules/@babel/types/lib/converters/valueToNode.js:98:9)
at Object.valueToNode (/home/hosuaby/projects/my-timesheet/node_modules/@babel/types/lib/converters/valueToNode.js:92:58)
at Object.exit (/home/hosuaby/projects/my-timesheet/node_modules/istanbul-lib-instrument/dist/visitor.js:641:30)
at PluginPass.exit (/home/hosuaby/projects/my-timesheet/node_modules/istanbul-lib-instrument/dist/instrumenter.js:104:29)
at newFn (/home/hosuaby/projects/my-timesheet/node_modules/@babel/traverse/lib/visitors.js:177:21)
at NodePath._call (/home/hosuaby/projects/my-timesheet/node_modules/@babel/traverse/lib/path/context.js:53:20)
at NodePath.call (/home/hosuaby/projects/my-timesheet/node_modules/@babel/traverse/lib/path/context.js:40:17)
at NodePath.visit (/home/hosuaby/projects/my-timesheet/node_modules/@babel/traverse/lib/path/context.js:99:8)
at TraversalContext.visitQueue (/home/hosuaby/projects/my-timesheet/node_modules/@babel/traverse/lib/context.js:103:16)
at TraversalContext.visitSingle (/home/hosuaby/projects/my-timesheet/node_modules/@babel/traverse/lib/context.js:77:19)
π Your Environment
Node: v16.4.2 Angular: 12.2.10
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:5
Top Results From Across the Web
Find out how much code you're testing - Angular
The code coverage percentages let you estimate how much of your code is tested. If your team decides on a set minimum amount...
Read more >After Upgrading to Angular 13 the tests with --code-coverage ...
I encountered the same issue after upgrading to Angular 13. Adding the Istanbul reporter compared to the Karma reporter solved my issue.
Read more >@angular-devkit/build-angular | Yarn - Package Manager
The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications directly from a command...
Read more >error: failed to initialize angular compilation - ngcc failed.
I was fortunate enough to not have a lot of dependencies in the project, so I went through each one and uninstalled it...
Read more >Angular 11 and Angular 12 upgrade in Kendo UI for Angular
But when upgrading from Angular 10 to 11 and Angular 11 to 12, I get the following errors: ... error Command failed with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Tested with 12.2.11 and my issues went away. Thanks!
I found a way to reproduce. Create a new project: ng new repro-app Then add the following comment anywhere to app.component.ts Then: ng test --code-coverage=true
I think more words than βasynchronousβ will cause the issue, but at least one way to reproduce.