Skip to content

Commit c29834c

Browse files
authored
fix(angular): ensure jest and jest-preset-angular are updated correctly for angular v21 (#33896)
## Current Behavior There's a deadlock between the Angular and Jest package updates requirements (`requires` and `incompatibleWith`) that prevents updating Jest to v30 and `jest-preset-angular` to v16. ## Expected Behavior Updating to Angular v21 should result in updating Jest to v30 and `jest-preset-angular` to v16. This is ensured by moving the `jest-preset-angular` package update definition to the `@nx/jest` package and processing the `@nx/angular` package updates before `@nx/jest`. That way, by the time `@nx/jest` is processed, the migrator would have collected the Angular v21 updates, and the requirements will be met.
1 parent 3384b1d commit c29834c

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

packages/angular/migrations.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,22 +2160,6 @@
21602160
"alwaysAddToPackageJson": false
21612161
}
21622162
}
2163-
},
2164-
"22.3.0-jest": {
2165-
"version": "22.3.0-beta.0",
2166-
"requires": {
2167-
"@angular/compiler-cli": ">=19.0.0 <22.0.0",
2168-
"@angular/core": ">=19.0.0 <22.0.0",
2169-
"@angular/platform-browser": ">=19.0.0 <22.0.0",
2170-
"@angular/platform-browser-dynamic": ">=19.0.0 <22.0.0",
2171-
"jest": "^30.0.0"
2172-
},
2173-
"packages": {
2174-
"jest-preset-angular": {
2175-
"version": "~16.0.0",
2176-
"alwaysAddToPackageJson": false
2177-
}
2178-
}
21792163
}
21802164
}
21812165
}

packages/jest/migrations.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
}
102102
},
103103
"22.3.0": {
104-
"version": "22.3.0-beta.0",
104+
"version": "22.3.0-beta.3",
105105
"x-prompt": "Do you want to update the Jest version to v30?",
106106
"incompatibleWith": {
107107
"@angular-devkit/build-angular": "< 21.0.0"
@@ -147,6 +147,22 @@
147147
"alwaysAddToPackageJson": false
148148
}
149149
}
150+
},
151+
"22.3.0-jest-preset-angular": {
152+
"version": "22.3.0-beta.3",
153+
"requires": {
154+
"@angular/compiler-cli": ">=19.0.0 <22.0.0",
155+
"@angular/core": ">=19.0.0 <22.0.0",
156+
"@angular/platform-browser": ">=19.0.0 <22.0.0",
157+
"@angular/platform-browser-dynamic": ">=19.0.0 <22.0.0",
158+
"jest": "^30.0.0"
159+
},
160+
"packages": {
161+
"jest-preset-angular": {
162+
"version": "~16.0.0",
163+
"alwaysAddToPackageJson": false
164+
}
165+
}
150166
}
151167
}
152168
}

packages/nx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@
101101
"migrations": "./migrations.json",
102102
"packageGroup": [
103103
"@nx/js",
104-
"@nx/jest",
105104
"@nx/linter",
106105
"@nx/eslint",
107106
"@nx/workspace",
108107
"@nx/angular",
108+
"@nx/jest",
109109
"@nx/cypress",
110110
"@nx/detox",
111111
"@nx/devkit",

0 commit comments

Comments
 (0)