Skip to content

Commit 52db560

Browse files
committed
build: add legaci-cli e2e bazel build
1 parent ada257d commit 52db560

File tree

12 files changed

+131
-3
lines changed

12 files changed

+131
-3
lines changed

.circleci/config.yml

+12
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ jobs:
254254
- custom_attach_workspace
255255
- run: yarn build
256256

257+
build-bazel-e2e:
258+
executor: action-executor
259+
steps:
260+
- custom_attach_workspace
261+
- run: yarn bazel build //tests/legacy-cli/...
262+
257263
test:
258264
executor: test-executor
259265
resource_class: xlarge
@@ -379,6 +385,12 @@ workflows:
379385
requires:
380386
- build
381387

388+
# Compile the e2e tests with bazel to ensure the non-runtime typescript
389+
# compilation completes succesfully.
390+
- build-bazel-e2e:
391+
requires:
392+
- build
393+
382394
# Windows jobs
383395
- e2e-cli-win:
384396
requires:

lib/BUILD.bazel

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("//tools:defaults.bzl", "ts_library")
2+
3+
ts_library(
4+
name = "lib",
5+
srcs = ["packages.ts"],
6+
visibility = ["//visibility:public"],
7+
deps = [
8+
"//packages/angular_devkit/core",
9+
"@npm//@types/node",
10+
"@npm//typescript",
11+
],
12+
)

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
"typescript": "4.7.1-rc",
213213
"verdaccio": "5.10.2",
214214
"verdaccio-auth-memory": "^10.0.0",
215+
"webdriver-manager": "^12.1.8",
215216
"webpack": "5.72.1",
216217
"webpack-dev-middleware": "5.3.3",
217218
"webpack-dev-server": "4.9.0",

tests/legacy-cli/BUILD.bazel

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
load("//tools:defaults.bzl", "ts_library")
2+
3+
ts_library(
4+
name = "runner",
5+
testonly = True,
6+
srcs = glob(["**/*.ts"]),
7+
data = [
8+
"verdaccio.yaml",
9+
"verdaccio_auth.yaml",
10+
],
11+
deps = [
12+
"//packages/angular_devkit/core",
13+
"//packages/angular_devkit/core/node",
14+
"//tests/legacy-cli/e2e/assets",
15+
"//tests/legacy-cli/e2e/utils",
16+
"@npm//@types/glob",
17+
"@npm//@types/yargs-parser",
18+
"@npm//ansi-colors",
19+
"@npm//yargs-parser",
20+
21+
# Loaded dynamically at runtime, not compiletime deps
22+
"//tests/legacy-cli/e2e/setup",
23+
"//tests/legacy-cli/e2e/tests",
24+
],
25+
)
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
load("//tools:defaults.bzl", "js_library")
2+
3+
js_library(
4+
name = "assets",
5+
srcs = glob(["**"]),
6+
visibility = ["//visibility:public"],
7+
deps = [
8+
"@npm//jasmine-spec-reporter",
9+
"@npm//ts-node",
10+
],
11+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
load("//tools:defaults.bzl", "ts_library")
2+
3+
ts_library(
4+
name = "ng-snapshot",
5+
srcs = [],
6+
data = ["package.json"],
7+
visibility = ["//visibility:public"],
8+
)
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
load("//tools:defaults.bzl", "ts_library")
2+
3+
ts_library(
4+
name = "setup",
5+
testonly = True,
6+
srcs = glob(["**/*.ts"]),
7+
visibility = ["//visibility:public"],
8+
deps = [
9+
"//tests/legacy-cli/e2e/utils",
10+
],
11+
)
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
load("//tools:defaults.bzl", "ts_library")
2+
3+
ts_library(
4+
name = "tests",
5+
testonly = True,
6+
srcs = glob(["**/*.ts"]),
7+
visibility = ["//visibility:public"],
8+
deps = [
9+
"//tests/legacy-cli/e2e/ng-snapshot",
10+
"//tests/legacy-cli/e2e/utils",
11+
"@npm//@types/express",
12+
"@npm//@types/glob",
13+
"@npm//@types/node-fetch",
14+
"@npm//@types/semver",
15+
"@npm//express",
16+
"@npm//glob",
17+
"@npm//node-fetch",
18+
"@npm//semver",
19+
],
20+
)
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
load("//tools:defaults.bzl", "ts_library")
2+
3+
ts_library(
4+
name = "utils",
5+
testonly = True,
6+
srcs = glob(["**/*.ts"]),
7+
visibility = ["//visibility:public"],
8+
deps = [
9+
"//lib",
10+
"//tests/legacy-cli/e2e/ng-snapshot",
11+
"@npm//@types/glob",
12+
"@npm//@types/node-fetch",
13+
"@npm//@types/semver",
14+
"@npm//@types/yargs-parser",
15+
"@npm//ansi-colors",
16+
"@npm//glob",
17+
"@npm//protractor",
18+
"@npm//puppeteer",
19+
"@npm//rxjs",
20+
"@npm//semver",
21+
"@npm//tree-kill",
22+
"@npm//verdaccio",
23+
"@npm//verdaccio-auth-memory",
24+
"@npm//webdriver-manager",
25+
],
26+
)

tests/legacy-cli/e2e/utils/process.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<Proce
147147
export function extractNpmEnv() {
148148
return Object.keys(process.env)
149149
.filter((v) => NPM_CONFIG_RE.test(v))
150-
.reduce(
150+
.reduce<NodeJS.ProcessEnv>(
151151
(vars, n) => {
152152
vars[n] = process.env[n];
153153
return vars;

tools/defaults.bzl

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Re-export of some bazel rules with repository-wide defaults."""
22

33
load("@npm//@bazel/concatjs/internal:build_defs.bzl", _ts_library = "ts_library_macro")
4-
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin", _pkg_npm = "pkg_npm")
4+
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin", _js_library = "js_library", _pkg_npm = "pkg_npm")
55
load("@rules_pkg//:pkg.bzl", "pkg_tar")
66
load("@npm//@angular/dev-infra-private/bazel:extract_js_module_output.bzl", "extract_js_module_output")
77
load("@aspect_bazel_lib//lib:utils.bzl", "to_label")
@@ -50,6 +50,8 @@ def ts_library(
5050
**kwargs
5151
)
5252

53+
js_library = _js_library
54+
5355
def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs):
5456
"""Override of pkg_npm to produce package outputs and version substitutions conventional to the angular-cli project.
5557

yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -10853,7 +10853,7 @@ [email protected]:
1085310853
"@types/selenium-webdriver" "^3.0.0"
1085410854
selenium-webdriver "^3.0.1"
1085510855

10856-
webdriver-manager@^12.1.7:
10856+
webdriver-manager@^12.1.7, webdriver-manager@^12.1.8:
1085710857
version "12.1.8"
1085810858
resolved "https://registry.yarnpkg.com/webdriver-manager/-/webdriver-manager-12.1.8.tgz#5e70e73eaaf53a0767d5745270addafbc5905fd4"
1085910859
integrity sha512-qJR36SXG2VwKugPcdwhaqcLQOD7r8P2Xiv9sfNbfZrKBnX243iAkOueX1yAmeNgIKhJ3YAT/F2gq6IiEZzahsg==

0 commit comments

Comments
 (0)