ng test error: "asset path must start with the project source root"
Command
test
Is this a regression?
- [x] Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
21.0.5
Description
We use the following asset paths config in ng-package.json in our library project:
"assets": ["./**/*.scss", "src/assets/i18n"],
Now this always worked fine, and even in 21.1.0 the library builds correctly and can be used in our demo, but since 21.1.0 ng test fails with Error: The ./**/*.scss asset path must start with the project source root.
The weird thing is, that project builds and runs perfectly as before, only ng test throws this error concerning project root source.
> ng test
An exception occurred while creating the test executor:
Error: The ./**/*.scss asset path must start with the project source root.
at /node_modules/@angular/build/src/utils/normalize-asset-patterns.js:71:23
at Array.map (<anonymous>)
at normalizeAssetPatterns (/node_modules/@angular/build/src/utils/normalize-asset-patterns.js:64:26)
at normalizeOptions (/node_modules/@angular/build/src/builders/application/options.js:77:46)
at async buildApplicationInternal (/node_modules/@angular/build/src/builders/application/index.js:86:31)
at async runBuildAndTest (/node_modules/@angular/build/src/builders/unit-test/builder.js:158:22)
at async execute (/node_modules/@angular/build/src/builders/unit-test/builder.js:330:13)
at async handleAsyncIterator (/node_modules/@angular-devkit/architect/src/api.js:38:28)
Minimal Reproduction
We use the following asset paths config in ng-package.json in our library project:
"assets": ["./**/*.scss", "src/assets/i18n"],
Then we run ng test.
Exception or Error
An exception occurred while creating the test executor:
Error: The ./**/*.scss asset path must start with the project source root.
at /node_modules/@angular/build/src/utils/normalize-asset-patterns.js:71:23
at Array.map (<anonymous>)
at normalizeAssetPatterns (/node_modules/@angular/build/src/utils/normalize-asset-patterns.js:64:26)
at normalizeOptions (/node_modules/@angular/build/src/builders/application/options.js:77:46)
at async buildApplicationInternal (/node_modules/@angular/build/src/builders/application/index.js:86:31)
at async runBuildAndTest (/node_modules/@angular/build/src/builders/unit-test/builder.js:158:22)
at async execute (/node_modules/@angular/build/src/builders/unit-test/builder.js:330:13)
at async handleAsyncIterator (/node_modules/@angular-devkit/architect/src/api.js:38:28)
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 21.1.0
Angular : 21.0.8
Node.js : 22.21.1
Package Manager : npm 10.9.4
Operating System : darwin arm64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations │ 21.0.8 │ ^21.0.8 │
│ @angular/build │ 21.1.0 │ ^21.1.0 │
│ @angular/cdk │ 21.0.6 │ ^21.0.6 │
│ @angular/cli │ 21.1.0 │ ^21.1.0 │
│ @angular/common │ 21.0.8 │ ^21.0.8 │
│ @angular/compiler │ 21.0.8 │ ^21.0.8 │
│ @angular/compiler-cli │ 21.0.8 │ ^21.0.8 │
│ @angular/core │ 21.0.8 │ ^21.0.8 │
│ @angular/forms │ 21.0.8 │ ^21.0.8 │
│ @angular/material │ 21.0.6 │ ^21.0.6 │
│ @angular/platform-browser │ 21.0.8 │ ^21.0.8 │
│ @angular/router │ 21.0.8 │ ^21.0.8 │
│ ng-packagr │ 21.0.0 │ ^21.0.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 5.9.3 │ ~5.9.3 │
│ vitest │ 4.0.14 │ ^4.0.14 │
│ zone.js │ 0.15.1 │ ^0.15.1 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
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.