Skip to content

Commit 42527ad

Browse files
committed
build: switch integration tests to pnpm and use rules_js-based rule
Switchs all integration tests to pnpm, solving one of our annoying bugs when installing integration test deps. It also seems much faster. In the future, we are considering allowing the local profile pnpm cache, even within the Bazel sandbox, but for now we continue installing dependencies via internet. In practice we even install a bit more dependencies now, but that is a trade-off we accept, because it's not making anything worse, but instead allows us to finally: - easily update the lock files manually - let renovate maintain versions of our integration tests; keeping them up-to-date.
1 parent 0d11695 commit 42527ad

21 files changed

+26850
-23793
lines changed

WORKSPACE

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ rules_js_register_toolchains(
102102
)
103103

104104
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
105-
load("//tools:integration.bzl", "create_npm_package_archive_build_file")
106105

107106
yarn_install(
108107
name = "npm",
@@ -120,8 +119,6 @@ yarn_install(
120119
# 1. Missing Windows support currently.
121120
# 2. Incompatibilites with the `ts_library` rule.
122121
exports_directories_only = False,
123-
# Add archive targets for some NPM packages that are needed in integration tests.
124-
manual_build_file_contents = create_npm_package_archive_build_file(),
125122
package_json = "//:package.json",
126123
quiet = False,
127124
yarn = "//:.yarn/releases/yarn-1.22.17.cjs",
@@ -205,6 +202,7 @@ npm_translate_lock(
205202
"@angular/material-luxon-adapter": ["//integration:__subpackages__"],
206203
},
207204
pnpm_lock = "//:pnpm-lock.yaml",
205+
pnpm_version = "9.14.1",
208206
update_pnpm_lock = True,
209207
verify_node_modules_ignored = "//:.bazelignore",
210208
yarn_lock = "//:yarn.lock",
@@ -251,7 +249,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
251249

252250
git_repository(
253251
name = "devinfra",
254-
commit = "cddc66a76ac0183790bc7a9fc1e5cf9f87512375",
252+
commit = "c4f7d3cdec164044284139182b709dfd4be339ed",
255253
remote = "https://github.com/angular/dev-infra.git",
256254
)
257255

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,16 @@
1-
load("@bazel_skylib//lib:dicts.bzl", "dicts")
2-
load("//tools:integration.bzl", "CLI_PROJECT_MAPPINGS")
3-
load("//tools:defaults.bzl", "node_integration_test")
1+
load("//tools:integration.bzl", "LOCAL_NPM_PACKAGES", "integration_test")
42

5-
npmPackageMappings = dicts.add(
6-
dicts.omit(
7-
CLI_PROJECT_MAPPINGS,
8-
# Exclude rxjs, because we want to use the version from the package.json.
9-
# Version 6.x that the rest of the project uses has some packaging issues. See:
10-
# https://github.com/angular/components/pull/25241#issuecomment-1178701633
11-
["@npm//:rxjs_archive"],
12-
),
13-
{
14-
"//src/cdk:npm_package_archive": "@angular/cdk",
15-
"//src/material:npm_package_archive": "@angular/material",
16-
},
17-
)
18-
19-
node_integration_test(
3+
integration_test(
204
name = "test",
215
srcs = glob(["**/*"]),
226
commands = [
23-
# Note: We use a cache folder within the integration test as otherwise
24-
# the NPM package mapped archive would be cached in the system.
25-
# See: https://github.com/yarnpkg/yarn/issues/2165.
26-
# TODO(devversion): determine if a solution/workaround could live in the test runner.
27-
"yarn install --cache-folder .yarn_cache_folder/",
28-
"yarn e2e",
7+
"pnpm i",
8+
"pnpm run e2e",
299
],
30-
npm_packages = npmPackageMappings,
10+
npm_packages = LOCAL_NPM_PACKAGES,
3111
setup_chromium = True,
3212
tags = [
33-
# This test relies on `yarn` so there needs to be internet access.
13+
# This test relies on `pnpm` so there needs to be internet access.
3414
"requires-network",
3515
],
3616
)

integration/harness-e2e-cli/package.json

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,35 @@
88
"watch": "ng build --watch --configuration development",
99
"test": "ng test",
1010
"run-e2e-specs": "node --loader ts-node/esm node_modules/jasmine/bin/jasmine --config=e2e/jasmine.json",
11-
"wait-and-run-e2e": "wait-on http://localhost:4200 && yarn run-e2e-specs",
12-
"e2e": "concurrently -s first -k 'ng serve' 'yarn wait-and-run-e2e'"
11+
"wait-and-run-e2e": "wait-on http://localhost:4200 && pnpm run-e2e-specs",
12+
"e2e": "concurrently -s first -k 'pnpm ng serve' 'pnpm wait-and-run-e2e'"
1313
},
1414
"private": true,
1515
"dependencies": {
16-
"@angular/animations": "file:../../node_modules/@angular/animations",
17-
"@angular/cdk": "file:../../dist/releases/cdk",
18-
"@angular/common": "file:../../node_modules/@angular/common",
19-
"@angular/compiler": "file:../../node_modules/@angular/compiler",
20-
"@angular/core": "file:../../node_modules/@angular/core",
21-
"@angular/forms": "file:../../node_modules/@angular/forms",
22-
"@angular/material": "file:../../dist/releases/material",
23-
"@angular/platform-browser": "file:../../node_modules/@angular/platform-browser",
24-
"@angular/platform-browser-dynamic": "file:../../node_modules/@angular/platform-browser-dynamic",
25-
"@angular/router": "file:../../node_modules/@angular/router",
16+
"@angular/animations": "20.0.0-next.5",
17+
"@angular/cdk": "next",
18+
"@angular/common": "20.0.0-next.5",
19+
"@angular/compiler": "20.0.0-next.5",
20+
"@angular/core": "20.0.0-next.5",
21+
"@angular/forms": "20.0.0-next.5",
22+
"@angular/material": "next",
23+
"@angular/platform-browser": "20.0.0-next.5",
24+
"@angular/router": "20.0.0-next.5",
2625
"rxjs": "^7.5.5",
2726
"tslib": "^2.3.0",
2827
"zone.js": "~0.15.0"
2928
},
3029
"devDependencies": {
31-
"@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular",
32-
"@angular/cli": "file:../../node_modules/@angular/cli",
33-
"@angular/compiler-cli": "file:../../node_modules/@angular/compiler-cli",
34-
"@types/jasmine": "~3.10.0",
35-
"@types/node": "^12.11.1",
30+
"@angular-devkit/build-angular": "20.0.0-next.4",
31+
"@angular/cli": "20.0.0-next.4",
32+
"@angular/compiler-cli": "20.0.0-next.5",
33+
"@types/jasmine": "5.1.7",
34+
"@types/node": "22.14.0",
3635
"@types/selenium-webdriver": "3.0.19",
3736
"concurrently": "^7.0.0",
38-
"jasmine": "^4.0.2",
39-
"jasmine-core": "~3.10.0",
40-
"karma": "~6.3.0",
37+
"jasmine": "5.6.0",
38+
"jasmine-core": "5.6.0",
39+
"karma": "6.4.4",
4140
"karma-chrome-launcher": "~3.1.0",
4241
"karma-coverage": "~2.1.0",
4342
"karma-jasmine": "~4.0.0",
@@ -46,9 +45,5 @@
4645
"ts-node": "~10.9.1",
4746
"typescript": "5.8.2",
4847
"wait-on": "^6.0.0"
49-
},
50-
"resolutions": {
51-
"string-width": "4.2.3",
52-
"wrap-ansi": "7.0.0"
5348
}
5449
}

0 commit comments

Comments
 (0)