-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Open
Description
Command
test
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
In the unit test schema, the "items" property of the array type, is a list. The NX schema validator doesn't support lists under the items property, only objects.
angular-cli/packages/angular/build/src/builders/unit-test/schema.json
Lines 218 to 241 in 15794dc
| "items": [ | |
| { | |
| "anyOf": [ | |
| { | |
| "type": "string" | |
| }, | |
| { | |
| "enum": [ | |
| "default", | |
| "verbose", | |
| "dots", | |
| "json", | |
| "junit", | |
| "tap", | |
| "tap-flat", | |
| "html" | |
| ] | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "object" | |
| } | |
| ] |
This can be easily made compatible again by replacing the list with a oneOf property. This doesn't provide the exact same validation, but it's close.
{
"type": "array",
"minItems": 1,
"maxItems": 2,
"items": {
"oneOf": [
{
"anyOf": [
{
"type": "string"
},
{
"enum": [
"default",
"verbose",
"dots",
"json",
"junit",
"tap",
"tap-flat",
"html"
]
}
]
},
{
"type": "object"
}
]
}
}Minimal Reproduction
In https://github.com/Ionaru/schema7fail:
- Run
npm install - Run
nx test my-app
Clean repro:
- Create an NX project with an Angular application
- In
project.jsonadd:
"test": {
"executor": "@angular/build:unit-test",
"options": {
"reporters": [["junit", {"suiteName": "MyApp"}]]
}
}- Run
nx test <app_name>
Exception or Error
NX Property 'reporters' does not match the schema.
{
"oneOf": [
{
"anyOf": [
{
"type": "string"
},
{
"enum": [
"default",
"verbose",
"dots",
"json",
"junit",
"tap",
"tap-flat",
"html"
]
}
]
},
{
"type": "array",
"minItems": 1,
"maxItems": 2,
"items": [
{
"anyOf": [
{
"type": "string"
},
{
"enum": [
"default",
"verbose",
"dots",
"json",
"junit",
"tap",
"tap-flat",
"html"
]
}
]
},
{
"type": "object"
}
]
}
]
}'
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 21.2.0
Angular : 21.2.0
Node.js : 24.14.0
Package Manager : npm 11.11.0
Operating System : win32 x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.2.0 │ ^21.2.0 │
│ @angular/cli │ 21.2.0 │ ^21.2.0 │
│ @angular/common │ 21.2.0 │ ^21.2.0 │
│ @angular/compiler │ 21.2.0 │ ^21.2.0 │
│ @angular/compiler-cli │ 21.2.0 │ ^21.2.0 │
│ @angular/core │ 21.2.0 │ ^21.2.0 │
│ @angular/forms │ 21.2.0 │ ^21.2.0 │
│ @angular/platform-browser │ 21.2.0 │ ^21.2.0 │
│ @angular/router │ 21.2.0 │ ^21.2.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 5.9.3 │ ~5.9.2 │
│ vitest │ 4.0.18 │ ^4.0.8 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
Linked to nrwl/nx#34631
Reactions are currently unavailable