Skip to content

Running test with --code-coverage fail with @angular-devkit/build-angular 14.0.3 #23467

Closed

Description

@christiangoudreau

🐞 Bug report

Command (mark with an x)

ng test --code-coverage

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes. @angular-devkit/build-angular 14.0.2 works as expected.

Description

An error is thrown when running tests.

🔬 Minimal Reproduction

Just run test with code coverage

🔥 Exception or Error

⠋ Generating browser application bundles (phase: setup)...An unhandled exception occurred: EACCES: permission denied, scandir '/boot/efi'

And the angular log contain :
[error] Error: EACCES: permission denied, scandir '/boot/efi'
at Object.readdirSync (node:fs:1405:3)
at GlobSync._readdir (/home/damob/projects/pm2/frontend/node_modules/@angular-devkit/build-angular/node_modules/glob/sync.js:288:46)
at GlobSync._readdirInGlobStar (/home/damob/projects/pm2/frontend/node_modules/@angular-devkit/build-angular/node_modules/glob/sync.js:267:20)
at GlobSync._readdir (/home/damob/projects/pm2/frontend/node_modules/@angular-devkit/build-angular/node_modules/glob/sync.js:276:17)
at GlobSync._processReaddir (/home/damob/projects/pm2/frontend/node_modules/@angular-devkit/build-angular/node_modules/glob/sync.js:137:22)
at GlobSync._process (/home/damob/projects/pm2/frontend/node_modules/@angular-devkit/build-angular/node_modules/glob/sync.js:132:10)
at GlobSync._processGlobStar (/home/damob/projects/pm2/frontend/node_modules/@angular-devkit/build-angular/node_modules/glob/sync.js:380:10)
at GlobSync._process (/home/damob/projects/pm2/frontend/node_modules/@angular-devkit/build-angular/node_modules/glob/sync.js:130:10)
at GlobSync._processGlobStar (/home/damob/projects/pm2/frontend/node_modules/@angular-devkit/build-angular/node_modules/glob/sync.js:383:10)
at GlobSync._process (/home/damob/projects/pm2/frontend/node_modules/@angular-devkit/build-angular/node_modules/glob/sync.js:130:10)

🌍 Your Environment


Angular CLI: 14.0.3
Node: 16.15.0
Package Manager: yarn 3.2.1 
OS: linux x64

Angular: 14.0.3
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, material, material-moment-adapter, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.3
@angular-devkit/build-angular   14.0.3
@angular-devkit/core            14.0.3
@angular-devkit/schematics      14.0.3
@angular/flex-layout            13.0.0-beta.38
@schematics/angular             14.0.3
ng-packagr                      14.0.2
rxjs                            7.5.5
typescript                      4.7.4

Activity

  1. alan-agius4 commented on Jun 29, 2022

    @alan-agius4
    Collaborator

    Can you share the test section of your angular.json?

  2. added
    needs: more info
    on Jun 29, 2022
  3. self-assigned this
    on Jun 29, 2022
  4. christiangoudreau commented on Jun 29, 2022

    @christiangoudreau
    Author

    Sure. That being said, tests runs correctly without --code-coverage

                    "test": {
                        "configurations": {
                            "ci": {
                                "karmaConfig": "projects/investors/karma.conf.ci.js"
                            }
                        },
                        "builder": "@angular-devkit/build-angular:karma",
                        "options": {
                            "main": "projects/investors/src/test.ts",
                            "polyfills": "projects/investors/src/polyfills.ts",
                            "tsConfig": "projects/investors/tsconfig.spec.json",
                            "karmaConfig": "projects/investors/karma.conf.js",
                            "codeCoverageExclude": [
                                "/**/*.module.ts",
                                "/**/providers.ts"
                            ]
                        }
                    },
    
  5. alan-agius4 commented on Jun 29, 2022

    @alan-agius4
    Collaborator

    In general we don’t expect paths to start with a forward slash.

    As a workaround you could remove the leading / from the codeCoverageExclude paths.

    We should disallow mounting of globs starting with forward slash.

  6. added
    freq1: low
    and removed
    needs: more info
    on Jun 29, 2022
  7. christiangoudreau commented on Jun 29, 2022

    @christiangoudreau
    Author

    You think it's only that ? I'll try

  8. alan-agius4 commented on Jun 30, 2022

    @alan-agius4
    Collaborator

    You think it's only that ? I'll try

    Yes

  9. added 4 commits that reference this issue on Jun 30, 2022
    2ffe038
    166198b
    eaeef05
    0e6875e
  10. added 2 commits that reference this issue on Jun 30, 2022
    7a24609
    aa8ed53
  11. christiangoudreau commented on Jun 30, 2022

    @christiangoudreau
    Author

    I does fix the problem, thank you really much!

  12. added a commit that references this issue on Jul 30, 2022
  13. angular-automatic-lock-bot commented on Jul 31, 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.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions