Skip to content

Commit df51acd

Browse files
committed
refactor: remove experimental Jest and Web Test Runner builders
The experimental Jest and Web Test Runner builders have been removed from the Angular CLI. These builders were experimental and have been superseded. BREAKING CHANGE: The experimental `@angular-devkit/build-angular:jest` and `@angular-devkit/build-angular:web-test-runner` builders have been removed.
1 parent bfdc7b0 commit df51acd

File tree

30 files changed

+7
-2950
lines changed

30 files changed

+7
-2950
lines changed

packages/angular/cli/lib/config/workspace-schema.json

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@
417417
"@angular-devkit/build-angular:karma",
418418
"@angular-devkit/build-angular:ng-packagr",
419419
"@angular-devkit/build-angular:prerender",
420-
"@angular-devkit/build-angular:jest",
421-
"@angular-devkit/build-angular:web-test-runner",
422420
"@angular-devkit/build-angular:server",
423421
"@angular-devkit/build-angular:ssr-dev-server"
424422
]
@@ -706,50 +704,6 @@
706704
}
707705
}
708706
},
709-
{
710-
"type": "object",
711-
"additionalProperties": false,
712-
"properties": {
713-
"builder": {
714-
"const": "@angular-devkit/build-angular:jest"
715-
},
716-
"defaultConfiguration": {
717-
"type": "string",
718-
"description": "A default named configuration to use when a target configuration is not provided."
719-
},
720-
"options": {
721-
"$ref": "../../../../angular_devkit/build_angular/src/builders/jest/schema.json"
722-
},
723-
"configurations": {
724-
"type": "object",
725-
"additionalProperties": {
726-
"$ref": "../../../../angular_devkit/build_angular/src/builders/jest/schema.json"
727-
}
728-
}
729-
}
730-
},
731-
{
732-
"type": "object",
733-
"additionalProperties": false,
734-
"properties": {
735-
"builder": {
736-
"const": "@angular-devkit/build-angular:web-test-runner"
737-
},
738-
"defaultConfiguration": {
739-
"type": "string",
740-
"description": "A default named configuration to use when a target configuration is not provided."
741-
},
742-
"options": {
743-
"$ref": "../../../../angular_devkit/build_angular/src/builders/web-test-runner/schema.json"
744-
},
745-
"configurations": {
746-
"type": "object",
747-
"additionalProperties": {
748-
"$ref": "../../../../angular_devkit/build_angular/src/builders/web-test-runner/schema.json"
749-
}
750-
}
751-
}
752-
},
753707
{
754708
"type": "object",
755709
"additionalProperties": false,

packages/angular/cli/src/commands/mcp/tools/projects.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ const listProjectsOutputSchema = {
7575
` For example, a prefix of 'app' would result in selectors like '<app-my-component>'.`,
7676
),
7777
unitTestFramework: z
78-
.enum(['jasmine', 'jest', 'vitest', 'unknown'])
78+
.enum(['jasmine', 'vitest', 'unknown'])
7979
.optional()
8080
.describe(
81-
'The unit test framework used by the project, such as Jasmine, Jest, or Vitest. ' +
81+
'The unit test framework used by the project, such as Jasmine, or Vitest. ' +
8282
'This field is critical for generating correct and idiomatic unit tests. ' +
8383
'When writing or modifying tests, you MUST use the APIs corresponding to this framework.',
8484
),
@@ -135,9 +135,9 @@ their types, and their locations.
135135
<Operational Notes>
136136
* **Working Directory:** Shell commands for a project (like \`ng generate\`) **MUST**
137137
be executed from the parent directory of the \`path\` field for the relevant workspace.
138-
* **Unit Testing:** The \`unitTestFramework\` field tells you which testing API to use (e.g., Jasmine, Jest).
138+
* **Unit Testing:** The \`unitTestFramework\` field tells you which testing API to use (e.g., Jasmine).
139139
If the value is 'unknown', you **MUST** inspect the project's configuration files
140-
(e.g., \`karma.conf.js\`, \`jest.config.js\`, or the 'test' target in \`angular.json\`) to determine the
140+
(e.g., \`karma.conf.js\`, or the 'test' target in \`angular.json\`) to determine the
141141
framework before generating tests.
142142
* **Disambiguation:** A monorepo may contain multiple workspaces (e.g., for different applications or even in output directories).
143143
Use the \`path\` of each workspace to understand its context and choose the correct project.
@@ -337,12 +337,12 @@ type VersioningError = z.infer<typeof listProjectsOutputSchema.versioningErrors>
337337
* It handles both the modern `@angular/build:unit-test` builder with its `runner` option
338338
* and older builders where the framework is inferred from the builder name.
339339
* @param testTarget The 'test' target definition from the workspace configuration.
340-
* @returns The name of the unit test framework ('jasmine', 'jest', 'vitest'), 'unknown' if
340+
* @returns The name of the unit test framework ('jasmine', 'vitest'), 'unknown' if
341341
* the framework can't be determined from a known builder, or `undefined` if there is no test target.
342342
*/
343343
function getUnitTestFramework(
344344
testTarget: import('@angular-devkit/core').workspaces.TargetDefinition | undefined,
345-
): 'jasmine' | 'jest' | 'vitest' | 'unknown' | undefined {
345+
): 'jasmine' | 'vitest' | 'unknown' | undefined {
346346
if (!testTarget) {
347347
return undefined;
348348
}
@@ -360,13 +360,8 @@ function getUnitTestFramework(
360360
// Fallback for older builders where the framework is inferred from the builder name.
361361
if (testTarget.builder) {
362362
const testBuilder = testTarget.builder;
363-
if (
364-
testBuilder.includes('karma') ||
365-
testBuilder === '@angular-devkit/build-angular:web-test-runner'
366-
) {
363+
if (testBuilder.includes('karma')) {
367364
return 'jasmine';
368-
} else if (testBuilder.includes('jest')) {
369-
return 'jest';
370365
} else if (testBuilder.includes('vitest')) {
371366
return 'vitest';
372367
} else {

packages/angular_devkit/build_angular/BUILD.bazel

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ ts_json_schema(
3939
src = "src/builders/extract-i18n/schema.json",
4040
)
4141

42-
ts_json_schema(
43-
name = "jest_schema",
44-
src = "src/builders/jest/schema.json",
45-
)
46-
4742
ts_json_schema(
4843
name = "karma_schema",
4944
src = "src/builders/karma/schema.json",
@@ -74,11 +69,6 @@ ts_json_schema(
7469
src = "src/builders/prerender/schema.json",
7570
)
7671

77-
ts_json_schema(
78-
name = "web_test_runner_schema",
79-
src = "src/builders/web-test-runner/schema.json",
80-
)
81-
8272
copy_to_bin(
8373
name = "schemas",
8474
srcs = glob(["**/schema.json"]),
@@ -88,7 +78,6 @@ RUNTIME_ASSETS = glob(
8878
include = [
8979
"src/**/schema.json",
9080
"src/**/*.js",
91-
"src/**/*.mjs",
9281
"src/**/*.html",
9382
],
9483
) + [
@@ -117,14 +106,12 @@ ts_project(
117106
"//packages/angular_devkit/build_angular:src/builders/browser/schema.ts",
118107
"//packages/angular_devkit/build_angular:src/builders/dev-server/schema.ts",
119108
"//packages/angular_devkit/build_angular:src/builders/extract-i18n/schema.ts",
120-
"//packages/angular_devkit/build_angular:src/builders/jest/schema.ts",
121109
"//packages/angular_devkit/build_angular:src/builders/karma/schema.ts",
122110
"//packages/angular_devkit/build_angular:src/builders/ng-packagr/schema.ts",
123111
"//packages/angular_devkit/build_angular:src/builders/prerender/schema.ts",
124112
"//packages/angular_devkit/build_angular:src/builders/protractor/schema.ts",
125113
"//packages/angular_devkit/build_angular:src/builders/server/schema.ts",
126114
"//packages/angular_devkit/build_angular:src/builders/ssr-dev-server/schema.ts",
127-
"//packages/angular_devkit/build_angular:src/builders/web-test-runner/schema.ts",
128115
],
129116
data = RUNTIME_ASSETS,
130117
deps = [
@@ -145,7 +132,6 @@ ts_project(
145132
":node_modules/@babel/runtime",
146133
":node_modules/@discoveryjs/json-ext",
147134
":node_modules/@ngtools/webpack",
148-
":node_modules/@web/test-runner",
149135
":node_modules/ansi-colors",
150136
":node_modules/autoprefixer",
151137
":node_modules/babel-loader",

packages/angular_devkit/build_angular/builders.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,11 @@
2727
"schema": "./src/builders/extract-i18n/schema.json",
2828
"description": "Extract i18n strings from a browser application."
2929
},
30-
"jest": {
31-
"implementation": "./src/builders/jest",
32-
"schema": "./src/builders/jest/schema.json",
33-
"description": "Run unit tests using Jest."
34-
},
3530
"karma": {
3631
"implementation": "./src/builders/karma",
3732
"schema": "./src/builders/karma/schema.json",
3833
"description": "Run Karma unit tests."
3934
},
40-
"web-test-runner": {
41-
"implementation": "./src/builders/web-test-runner",
42-
"schema": "./src/builders/web-test-runner/schema.json",
43-
"description": "Run unit tests with Web Test Runner."
44-
},
4535
"protractor": {
4636
"implementation": "./src/builders/protractor-error",
4737
"schema": "./src/builders/protractor/schema.json",

packages/angular_devkit/build_angular/package.json

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
},
6767
"devDependencies": {
6868
"@angular/ssr": "workspace:*",
69-
"@web/test-runner": "0.20.2",
7069
"browser-sync": "3.0.4",
7170
"ng-packagr": "21.2.0-next.0",
7271
"undici": "7.22.0"
@@ -79,10 +78,7 @@
7978
"@angular/platform-server": "0.0.0-ANGULAR-FW-PEER-DEP",
8079
"@angular/service-worker": "0.0.0-ANGULAR-FW-PEER-DEP",
8180
"@angular/ssr": "^0.0.0-PLACEHOLDER",
82-
"@web/test-runner": "^0.20.0",
8381
"browser-sync": "^3.0.2",
84-
"jest": "^30.2.0",
85-
"jest-environment-jsdom": "^30.2.0",
8682
"karma": "^6.3.0",
8783
"ng-packagr": "0.0.0-NG-PACKAGR-PEER-DEP",
8884
"protractor": "^7.0.0",
@@ -108,18 +104,9 @@
108104
"@angular/ssr": {
109105
"optional": true
110106
},
111-
"@web/test-runner": {
112-
"optional": true
113-
},
114107
"browser-sync": {
115108
"optional": true
116109
},
117-
"jest": {
118-
"optional": true
119-
},
120-
"jest-environment-jsdom": {
121-
"optional": true
122-
},
123110
"karma": {
124111
"optional": true
125112
},

0 commit comments

Comments
 (0)