Skip to content

using BuilderContext from @angular-devkit/architect to run angular unit test converts undefined to default type value #32652

Description

@BharathSubu

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

i have multiple libs so for each lib the unit test is running using @angular/build:unit-test in jsdom , like this

"test": { "builder": "@angular/build:unit-test", "options": { "tsConfig": "libs/mylib/tsconfig.spec.json", "runnerConfig": "libs/mylib/vitest.config.ts", "watch": false } },

to run all utest of all libs im using

"test-all": { "builder": "dist:build-all", "options": { "targets": [ mylib:test , mylib1:test ] } },

this dist:build-all uses BuilderContext from @angular-devkit/architect

await this.context.scheduleTarget(target, overrides);

issue is when running mylib:test the test run fines , but when running project:test-all

angular unit test fails with list of supported browser not specified

the issue

when running mylib:test the parameter passed to @angular/build:unit-test is browser = undefined
but when running project:test-all the parameter passed to @angular/build:unit-test is browser = []

coz internally await this.context.scheduleTarget(target, overrides); convert undefined to default value i guess here it is []

so is there any way i can make sure this conversion doesnt happen , or specify @angular/build:unit-test to not run the test in browser

Image

this issue also happend when coverageIncludes is not specified , when ran using @angular/build:unit-test
coverageIncludes is undefined , but when ran using await this.context.scheduleTarget(target, overrides); the value passed is [] and coverage is not reported

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)


Angular CLI       : 21.1.0
Angular           : 21.1.0
Node.js           : 22.18.0
Package Manager   : yarn 1.22.22
Operating System  : win32 x64

┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package                           │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular-devkit/architect         │ 0.2101.0          │ 0.2101.0          │
│ @angular-devkit/build-angular     │ 21.1.0            │ 21.1.0            │
│ @angular-devkit/core              │ 21.1.0            │ 21.1.0            │
│ @angular-devkit/schematics        │ 21.1.0            │ 21.1.0            │
│ @angular-devkit/schematics-cli    │ 21.1.0            │ 21.1.0            │
│ @angular/animations               │ 21.1.0            │ 21.1.0            │
│ @angular/build                    │ 21.1.0            │ 21.1.0            │
│ @angular/cdk                      │ 21.1.0            │ 21.1.0            │
│ @angular/cli                      │ 21.1.0            │ 21.1.0            │
│ @angular/common                   │ 21.1.0            │ 21.1.0            │
│ @angular/compiler                 │ 21.1.0            │ 21.1.0            │
│ @angular/compiler-cli             │ 21.1.0            │ 21.1.0            │
│ @angular/core                     │ 21.1.0            │ 21.1.0            │
│ @angular/elements                 │ 21.1.0            │ 21.1.0            │
│ @angular/forms                    │ 21.1.0            │ 21.1.0            │
│ @angular/language-service         │ 21.1.0            │ 21.1.0            │
│ @angular/localize                 │ 21.1.0            │ 21.1.0            │
│ @angular/material                 │ 21.1.0            │ 21.1.0            │
│ @angular/platform-browser         │ 21.1.0            │ 21.1.0            │
│ @angular/platform-browser-dynamic │ 21.1.0            │ 21.1.0            │
│ @angular/router                   │ 21.1.0            │ 21.1.0            │
│ @angular/service-worker           │ 21.1.0            │ 21.1.0            │
│ ng-packagr                        │ 21.1.0            │ 21.1.0            │
│ rxjs                              │ 7.8.2             │ 7.8.2             │
│ typescript                        │ 5.9.3             │ 5.9.3             │
│ vitest                            │ 4.0.18            │ 4.0.18            │
│ webpack                           │ 5.105.0           │ 5.105.0           │
│ zone.js                           │ 0.16.0            │ 0.16.0            │

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions