question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Reactions:11
  • Comments:5

github_iconTop GitHub Comments

2reactions
rbirkgitcommented, Oct 21, 2021

Tested with 12.2.11 and my issues went away. Thanks!

1reaction
rbirkgitcommented, Oct 18, 2021

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

// asynchronous

I think more words than β€˜asynchronous’ will cause the issue, but at least one way to reproduce.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found