Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 15 tasks
christiangoudreau opened this issue Jun 29, 2022 · 7 comments · Fixed by #23472
Closed
1 of 15 tasks
Assignees
Labels
2022Q3 Fixit Candidates for the Q3 2022 fix-it area: @angular-devkit/build-angular devkit/build-angular:karma freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix

Comments

@christiangoudreau
Copy link

🐞 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
@alan-agius4
Copy link
Collaborator

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

@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label Jun 29, 2022
@alan-agius4 alan-agius4 self-assigned this Jun 29, 2022
@christiangoudreau
Copy link
Author

christiangoudreau commented Jun 29, 2022

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"
                        ]
                    }
                },

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 29, 2022

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.

@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely area: @angular-devkit/build-angular devkit/build-angular:karma 2022Q3 Fixit Candidates for the Q3 2022 fix-it severity5: regression and removed needs: more info Reporter must clarify the issue labels Jun 29, 2022
@christiangoudreau
Copy link
Author

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

@alan-agius4
Copy link
Collaborator

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

Yes

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jun 30, 2022
…s that start with a forward slash

By default, a glob pattern starting with a forward slash will be "mounted" onto the system root. This causes globs to escape the workspace root.

With this change we configure disable glob "mounting".

Closes angular#23467
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jun 30, 2022
…s that start with a forward slash

By default, a glob pattern starting with a forward slash will be "mounted" onto the system root. This causes globs to escape the workspace root.

With this change we configure disable glob "mounting".

Closes angular#23467
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jun 30, 2022
…s that start with a forward slash

By default, a glob pattern starting with a forward slash will be "mounted" onto the system root. This causes globs to escape the workspace root.

With this change we configure disable glob "mounting".

Closes angular#23467
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jun 30, 2022
…s that start with a forward slash

By default, a glob pattern starting with a forward slash will be "mounted" onto the system root. This causes globs to escape the workspace root.

With this change we configure disable glob "mounting" and also change the root to the same setting of the `cwd`.

Closes angular#23467
clydin pushed a commit that referenced this issue Jun 30, 2022
…s that start with a forward slash

By default, a glob pattern starting with a forward slash will be "mounted" onto the system root. This causes globs to escape the workspace root.

With this change we configure disable glob "mounting" and also change the root to the same setting of the `cwd`.

Closes #23467
clydin pushed a commit that referenced this issue Jun 30, 2022
…s that start with a forward slash

By default, a glob pattern starting with a forward slash will be "mounted" onto the system root. This causes globs to escape the workspace root.

With this change we configure disable glob "mounting" and also change the root to the same setting of the `cwd`.

Closes #23467

(cherry picked from commit 7a24609)
@christiangoudreau
Copy link
Author

I does fix the problem, thank you really much!

qdelettre added a commit to qdelettre/awesome-hangman that referenced this issue Jul 30, 2022
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2022Q3 Fixit Candidates for the Q3 2022 fix-it area: @angular-devkit/build-angular devkit/build-angular:karma freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Projects
None yet
2 participants