Skip to content

Commit 66fa06c

Browse files
committed
build: migrate @angular/build tests to rules_js
Migrates `@angular/build` tests to native `rules_js`. This involves wiring up the package in the pnpm workspace, as well as adding some missing dependencies that previously weren't needed due to less efficient per-package isolation of transitive deps. In addition, we need to explicitly specify `ssr` as dev dependency as we are not auto-installing peer deps, and the dependency is needed for some server SSR tests.
1 parent 5afcfc0 commit 66fa06c

File tree

8 files changed

+140
-916
lines changed

8 files changed

+140
-916
lines changed

.aspect/rules/external_repository_action_cache/npm_translate_lock_MzA5NzUwNzMx

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Input hashes for repository rule npm_translate_lock(name = "npm2", pnpm_lock = "@//:pnpm-lock.yaml").
33
# This file should be checked into version control along with the pnpm-lock.yaml file.
44
.npmrc=-1406867100
5-
modules/testing/builder/package.json=-1769051440
6-
package.json=688000741
7-
packages/angular/build/package.json=1789788715
5+
modules/testing/builder/package.json=-1196120648
6+
package.json=-865553716
7+
packages/angular/build/package.json=954937711
88
packages/angular/cli/package.json=349838588
99
packages/angular/pwa/package.json=-1352285148
1010
packages/angular/ssr/package.json=120782115
@@ -17,6 +17,6 @@ packages/angular_devkit/schematics/package.json=673943597
1717
packages/angular_devkit/schematics_cli/package.json=-356386813
1818
packages/ngtools/webpack/package.json=-942726894
1919
packages/schematics/angular/package.json=251715148
20-
pnpm-lock.yaml=-870184322
21-
pnpm-workspace.yaml=-1173266031
20+
pnpm-lock.yaml=1087719969
21+
pnpm-workspace.yaml=-1847919625
2222
yarn.lock=969972397

modules/testing/builder/BUILD.bazel

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ ts_project(
1616
"src/**/*_spec.ts",
1717
],
1818
),
19-
data = glob(["projects/**/*"]),
19+
data = [
20+
# Needed at runtime by some builder tests relying on SSR being
21+
# resolvable in the test project.
22+
":node_modules/@angular/ssr",
23+
] + glob(["projects/**/*"]),
2024
deps = [
2125
":node_modules/@angular-devkit/architect",
2226
":node_modules/@angular-devkit/core",

modules/testing/builder/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"devDependencies": {
33
"@angular-devkit/core": "workspace:*",
4-
"@angular-devkit/architect": "workspace:*"
4+
"@angular-devkit/architect": "workspace:*",
5+
"@angular/ssr": "workspace:*"
56
}
67
}

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@
221221
}
222222
},
223223
"pnpm": {
224-
"onlyBuiltDependencies": []
224+
"onlyBuiltDependencies": [],
225+
"overrides": {
226+
"@angular/build": "workspace:*"
227+
}
225228
},
226229
"resolutions": {
227230
"typescript": "5.7.3"

packages/angular/build/BUILD.bazel

+17-24
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
2-
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
3-
load("//tools:defaults2.bzl", "npm_package", "ts_project")
2+
load("@npm2//:defs.bzl", "npm_link_all_packages")
3+
load("//tools:defaults2.bzl", "jasmine_test", "npm_package", "ts_project")
44
load("//tools:ts_json_schema.bzl", "ts_json_schema")
55

66
licenses(["notice"])
77

88
package(default_visibility = ["//visibility:public"])
99

10+
npm_link_all_packages()
11+
1012
ts_json_schema(
1113
name = "application_schema",
1214
src = "src/builders/application/schema.json",
@@ -61,6 +63,9 @@ ts_project(
6163
data = RUNTIME_ASSETS,
6264
module_name = "@angular/build",
6365
deps = [
66+
":node_modules/@angular-devkit/architect",
67+
":node_modules/@angular-devkit/core",
68+
":node_modules/@angular/ssr",
6469
"//:node_modules/@ampproject/remapping",
6570
"//:node_modules/@angular/common",
6671
"//:node_modules/@angular/compiler",
@@ -87,7 +92,9 @@ ts_project(
8792
"//:node_modules/esbuild-wasm",
8893
"//:node_modules/fast-glob",
8994
"//:node_modules/https-proxy-agent",
95+
"//:node_modules/istanbul-lib-instrument",
9096
"//:node_modules/jsonc-parser",
97+
"//:node_modules/less",
9198
"//:node_modules/listr2",
9299
"//:node_modules/lmdb",
93100
"//:node_modules/magic-string",
@@ -104,10 +111,6 @@ ts_project(
104111
"//:node_modules/typescript",
105112
"//:node_modules/vite",
106113
"//:node_modules/watchpack",
107-
"//packages/angular/ssr:ssr_rjs",
108-
"//packages/angular/ssr/node:node_rjs",
109-
"//packages/angular_devkit/architect:architect_rjs",
110-
"//packages/angular_devkit/core:core_rjs",
111114
],
112115
)
113116

@@ -126,14 +129,12 @@ ts_project(
126129
"//:node_modules/prettier",
127130
"//:node_modules/typescript",
128131
"//packages/angular/build/private:private_rjs",
129-
"//packages/angular_devkit/core:core_rjs",
130-
"//packages/angular_devkit/core/node:node_rjs",
131132
],
132133
)
133134

134-
jasmine_node_test(
135+
jasmine_test(
135136
name = "unit_tests",
136-
deps = [":unit_test_lib"],
137+
data = [":unit_test_lib_rjs"],
137138
)
138139

139140
ts_project(
@@ -144,11 +145,7 @@ ts_project(
144145
":build_rjs",
145146
"//packages/angular/build/private:private_rjs",
146147
"//modules/testing/builder:builder_rjs",
147-
"//packages/angular_devkit/architect:architect_rjs",
148-
"//packages/angular_devkit/architect/node:node_rjs",
149-
"//packages/angular_devkit/architect/testing:testing_rjs",
150-
"//packages/angular_devkit/core:core_rjs",
151-
"//packages/angular_devkit/core/node:node_rjs",
148+
":node_modules/@angular-devkit/architect",
152149

153150
# Base dependencies for the application in hello-world-app.
154151
"//:node_modules/@angular/common",
@@ -174,11 +171,7 @@ ts_project(
174171
":build_rjs",
175172
"//packages/angular/build/private:private_rjs",
176173
"//modules/testing/builder:builder_rjs",
177-
"//packages/angular_devkit/architect:architect_rjs",
178-
"//packages/angular_devkit/architect/node:node_rjs",
179-
"//packages/angular_devkit/architect/testing:testing_rjs",
180-
"//packages/angular_devkit/core:core_rjs",
181-
"//packages/angular_devkit/core/node:node_rjs",
174+
":node_modules/@angular-devkit/architect",
182175

183176
# dev server only test deps
184177
"//:node_modules/@types/http-proxy",
@@ -202,20 +195,20 @@ ts_project(
202195
],
203196
)
204197

205-
jasmine_node_test(
198+
jasmine_test(
206199
name = "application_integration_tests",
207200
size = "large",
201+
data = [":application_integration_test_lib_rjs"],
208202
flaky = True,
209203
shard_count = 10,
210-
deps = [":application_integration_test_lib"],
211204
)
212205

213-
jasmine_node_test(
206+
jasmine_test(
214207
name = "dev-server_integration_tests",
215208
size = "large",
209+
data = [":dev-server_integration_test_lib_rjs"],
216210
flaky = True,
217211
shard_count = 10,
218-
deps = [":dev-server_integration_test_lib"],
219212
)
220213

221214
genrule(

packages/angular/build/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"builders": "builders.json",
2020
"dependencies": {
2121
"@ampproject/remapping": "2.3.0",
22-
"@angular-devkit/architect": "0.0.0-EXPERIMENTAL-PLACEHOLDER",
22+
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
23+
"@angular-devkit/architect": "workspace:0.0.0-EXPERIMENTAL-PLACEHOLDER",
2324
"@babel/core": "7.26.0",
2425
"@babel/helper-annotate-as-pure": "7.25.9",
2526
"@babel/helper-split-export-declaration": "7.24.7",
@@ -47,6 +48,9 @@
4748
"optionalDependencies": {
4849
"lmdb": "3.2.2"
4950
},
51+
"devDependencies": {
52+
"@angular/ssr": "workspace:*"
53+
},
5054
"peerDependencies": {
5155
"@angular/compiler": "^19.0.0",
5256
"@angular/compiler-cli": "^19.0.0",

0 commit comments

Comments
 (0)