Skip to content

Commit 6c72d08

Browse files
committed
test: unit test multiple node versions in separate jobs
1 parent 9171543 commit 6c72d08

File tree

15 files changed

+40
-12
lines changed

15 files changed

+40
-12
lines changed

.circleci/dynamic_config.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ parameters:
2525
var_1: &cache_key v1-angular_devkit-14.19-{{ checksum "yarn.lock" }}
2626
var_1_win: &cache_key_win v1-angular_devkit-win-16.10-{{ checksum "yarn.lock" }}
2727
var_3: &default_nodeversion '14.19'
28+
var_3_major: &default_nodeversion_major '14'
2829
# Workspace initially persisted by the `setup` job, and then enhanced by `setup-and-build-win`.
2930
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
3031
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
@@ -39,6 +40,9 @@ var_5: &only_release_branches
3940

4041
var_6: &all_e2e_subsets ['npm', 'esbuild', 'yarn']
4142

43+
# The major version of node toolchains. See tools/toolchain_info.bzl
44+
var_7_major: &all_test_nodeversion_major ['14', '16']
45+
4246
# Executor Definitions
4347
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
4448
executors:
@@ -291,16 +295,20 @@ jobs:
291295
- custom_attach_workspace
292296
- run: yarn bazel build //tests/legacy-cli/...
293297

294-
test:
298+
unit-test:
295299
executor: test-executor
296300
resource_class: xlarge
301+
parameters:
302+
nodeversion:
303+
type: string
304+
default: *default_nodeversion_major
297305
steps:
298306
- custom_attach_workspace
299307
- browser-tools/install-chrome
300308
- setup_bazel_rbe
301309
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
302310
- run:
303-
command: yarn bazel:test
311+
command: yarn bazel test --test_tag_filters=node<< parameters.nodeversion >>,-node<< parameters.nodeversion >>-broken //packages/...
304312
# This timeout provides time for the actual tests to timeout and report status
305313
# instead of CircleCI stopping the job without test failure information.
306314
no_output_timeout: 40m
@@ -429,7 +437,11 @@ workflows:
429437
# These jobs only really depend on Setup, but the build job is very quick to run (~35s) and
430438
# will catch any build errors before proceeding to the more lengthy and resource intensive
431439
# Bazel jobs.
432-
- test:
440+
- unit-test:
441+
name: test-node<< matrix.nodeversion >>
442+
matrix:
443+
parameters:
444+
nodeversion: *all_test_nodeversion_major
433445
requires:
434446
- build
435447

packages/angular/cli/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ ts_library(
156156
jasmine_node_test(
157157
name = "angular-cli_test_" + toolchain_name,
158158
srcs = [":angular-cli_test_lib"],
159+
tags = [toolchain_name],
159160
toolchain = toolchain,
160161
)
161162
for toolchain_name, toolchain in zip(

packages/angular/pwa/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ ts_library(
6767
jasmine_node_test(
6868
name = "pwa_test_" + toolchain_name,
6969
srcs = [":pwa_test_lib"],
70+
tags = [toolchain_name],
7071
toolchain = toolchain,
7172
)
7273
for toolchain_name, toolchain in zip(

packages/angular_devkit/architect/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ ts_library(
9595
jasmine_node_test(
9696
name = "architect_test_" + toolchain_name,
9797
srcs = [":architect_test_lib"],
98+
tags = [toolchain_name],
9899
toolchain = toolchain,
99100
)
100101
for toolchain_name, toolchain in zip(

packages/angular_devkit/benchmark/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ ts_library(
6060
jasmine_node_test(
6161
name = "benchmark_test_" + toolchain_name,
6262
srcs = [":benchmark_test_lib"],
63+
tags = [toolchain_name],
6364
toolchain = toolchain,
6465
deps = [
6566
"@npm//jasmine",

packages/angular_devkit/build_angular/BUILD.bazel

+6-1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ ts_library(
214214
jasmine_node_test(
215215
name = "build_angular_test_" + toolchain_name,
216216
srcs = [":build_angular_test_lib"],
217+
tags = [toolchain_name],
217218
toolchain = toolchain,
218219
)
219220
for toolchain_name, toolchain in zip(
@@ -400,7 +401,11 @@ LARGE_SPECS = {
400401
# These tests are resource intensive and should not be over-parallized as they will
401402
# compete for the resources of other parallel tests slowing everything down.
402403
# Ask Bazel to allocate multiple CPUs for these tests with "cpu:n" tag.
403-
tags = ["cpu:2"] + LARGE_SPECS[spec].get("tags", []),
404+
tags = [
405+
"cpu:2",
406+
toolchain_name,
407+
"node16-broken",
408+
] + LARGE_SPECS[spec].get("tags", []),
404409
toolchain = toolchain,
405410
deps = [":build_angular_" + spec + "_test_lib"],
406411
)

packages/angular_devkit/build_webpack/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ ts_library(
9292
jasmine_node_test(
9393
name = "build_webpack_test_" + toolchain_name,
9494
srcs = [":build_webpack_test_lib"],
95+
tags = [toolchain_name],
9596
# Turns off nodejs require patches and turns on the linker, which sets up up node_modules
9697
# so that standard node module resolution work.
9798
templated_args = ["--nobazel_patch_module_resolver"],

packages/angular_devkit/core/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ ts_library(
7272
srcs = [":core_test_lib"],
7373
# TODO: Audit tests to determine if tests can be run in RBE environments
7474
local = True,
75+
tags = [toolchain_name],
7576
toolchain = toolchain,
7677
deps = [
7778
# @node_module: ajv

packages/angular_devkit/core/node/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ ts_library(
5757
jasmine_node_test(
5858
name = "node_test_" + toolchain_name,
5959
srcs = [":node_test_lib"],
60+
tags = [toolchain_name],
6061
toolchain = toolchain,
6162
deps = [
6263
"@npm//chokidar",

packages/angular_devkit/schematics/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ ts_library(
6464
jasmine_node_test(
6565
name = "schematics_test_" + toolchain_name,
6666
srcs = [":schematics_test_lib"],
67+
tags = [toolchain_name],
6768
toolchain = toolchain,
6869
deps = [
6970
"@npm//jasmine",

packages/angular_devkit/schematics/tools/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ ts_library(
6262
jasmine_node_test(
6363
name = "tools_test_" + toolchain_name,
6464
srcs = [":tools_test_lib"],
65+
tags = [toolchain_name],
6566
toolchain = toolchain,
6667
deps = [
6768
"@npm//jasmine",

packages/angular_devkit/schematics_cli/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ ts_library(
7979
jasmine_node_test(
8080
name = "schematics_cli_test_" + toolchain_name,
8181
srcs = [":schematics_cli_test_lib"],
82+
tags = [toolchain_name],
8283
toolchain = toolchain,
8384
)
8485
for toolchain_name, toolchain in zip(

packages/ngtools/webpack/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ ts_library(
6262
jasmine_node_test(
6363
name = "webpack_test_" + toolchain_name,
6464
srcs = [":webpack_test_lib"],
65+
tags = [toolchain_name],
6566
toolchain = toolchain,
6667
deps = [
6768
"@npm//jasmine",

packages/schematics/angular/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ ts_library(
8787
jasmine_node_test(
8888
name = "no_typescript_runtime_dep_test_" + toolchain_name,
8989
srcs = ["no_typescript_runtime_dep_spec.js"],
90+
tags = [toolchain_name],
9091
toolchain = toolchain,
9192
deps = [
9293
":angular",
@@ -130,6 +131,7 @@ ts_library(
130131
jasmine_node_test(
131132
name = "angular_test_" + toolchain_name,
132133
srcs = [":angular_test_lib"],
134+
tags = [toolchain_name],
133135
toolchain = toolchain,
134136
deps = [
135137
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript",

tools/toolchain_info.bzl

+6-8
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
# the order will match against the order in the TOOLCHAIN_VERSION list.
55
TOOLCHAINS_NAMES = [
66
"node14",
7-
# TODO enable one we know more why there is a memory usage increase and app-shell tests work with Node.js 16.
8-
# "node16",
7+
"node16",
98
]
109

1110
# this is the list of toolchains that should be used and are registered with nodejs_register_toolchains in the WORKSPACE file
@@ -15,12 +14,11 @@ TOOLCHAINS_VERSIONS = [
1514
"@bazel_tools//src/conditions:darwin": "@node14_darwin_amd64//:node_toolchain",
1615
"@bazel_tools//src/conditions:windows": "@node14_windows_amd64//:node_toolchain",
1716
}),
18-
# TODO enable one we know more why there is a memory usage increase and app-shell tests work with Node.js 16.
19-
# select({
20-
# "@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_toolchain",
21-
# "@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain",
22-
# "@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_toolchain",
23-
# }),
17+
select({
18+
"@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_toolchain",
19+
"@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain",
20+
"@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_toolchain",
21+
}),
2422
]
2523

2624
# A default toolchain for use when only one is necessary

0 commit comments

Comments
 (0)