Skip to content

Coverage is undefined if sourceRoot is not set #23591

Closed

Description

@bgotink

🐞 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?

Yes, coverage was generated properly even with sourceRoot unset in angular 12.

Description

The @angular-devkit/build-angular builder fails to generate coverage if sourceRoot is not set. There's no error or warning linking this to the missing sourceRoot.

Possibly related to #22161, though the lack of a reproduction in that issue makes it unclear if it really is the same.

🔬 Minimal Reproduction

npx --package @angular/cli@latest ng new repro --defaults
cd repro
# remove the sourceRoot, e.g. via jq
jq 'del(.projects.repro.sourceRoot)' angular.json | sponge angular.json

# now run tests
npx ng test --code-coverage --watch false

🔥 Exception or Error


✔ Browser application bundle generation complete.
18 07 2022 14:34:09.375:INFO [karma-server]: Karma v6.3.20 server started at http://localhost:9876/
18 07 2022 14:34:09.376:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
18 07 2022 14:34:09.380:INFO [launcher]: Starting browser Chrome
18 07 2022 14:34:11.139:INFO [Chrome 103.0.5060.114 (Mac OS 10.15.7)]: Connected on socket GbDlEOfCDPMnbVHSAAAB with id 7822168
Chrome 103.0.5060.114 (Mac OS 10.15.7): Executed 3 of 3 SUCCESS (0.098 secs / 0.09 secs)
TOTAL: 3 SUCCESS

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================
✨  Done in 9.73s.

🌍 Your Environment


Angular CLI: 14.0.6
Node: 16.15.0
Package Manager: yarn 1.22.15 
OS: darwin x64

Angular: 14.0.6
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.6
@angular-devkit/build-angular   14.0.6
@angular-devkit/core            14.0.6
@angular-devkit/schematics      14.0.6
@schematics/angular             14.0.6
rxjs                            7.5.6
typescript                      4.7.4

Anything else relevant?

Activity

  1. self-assigned this
    on Jul 18, 2022
  2. added 2 commits that reference this issue on Jul 18, 2022
    ac08691
    e0d8916
  3. added 3 commits that reference this issue on Jul 18, 2022
    d8cfe8b
    cf9362e
    5810c2c
  4. angular-automatic-lock-bot commented on Aug 18, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions