Skip to content

Commit cfb31a7

Browse files
committed
test(@angular-devkit/core): add bazel tests
1 parent 180dfe6 commit cfb31a7

File tree

1 file changed

+84
-7
lines changed
  • packages/angular_devkit/core

1 file changed

+84
-7
lines changed

packages/angular_devkit/core/BUILD

Lines changed: 84 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55
package(default_visibility = ["//visibility:public"])
66

77
load("//tools:defaults.bzl", "ts_library")
8+
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
89

910
licenses(["notice"]) # MIT License
1011

12+
13+
# @angular-devkit/core
14+
1115
ts_library(
1216
name = "core",
1317
srcs = glob(
@@ -20,7 +24,11 @@ ts_library(
2024
),
2125
data = glob(["**/*.json"]),
2226
module_name = "@angular-devkit/core",
23-
module_root = "src",
27+
# Having `module_root = "src` causes `@angular-devkit/core/src/exception/exception` to be
28+
# resolved to `angular_cli/packages/angular_devkit/core/src/src/exception/exception` (notice
29+
# double 'src') in `resolveToModuleRoot`.
30+
# TODO(@filipesilva): figure out if 'src/index.ts' is the correct value, here and in others.
31+
module_root = "src/index.d.ts",
2432
deps = [
2533
"@rxjs",
2634
"@rxjs//operators",
@@ -33,32 +41,72 @@ ts_library(
3341
],
3442
)
3543

44+
ts_library(
45+
name = "core_test_lib",
46+
srcs = glob(
47+
include = [
48+
"src/**/*_spec.ts",
49+
"src/**/*_spec_large.ts",
50+
],
51+
exclude = [
52+
# The workspace spec expects workspace.json to be there, but it's not.
53+
# TODO(@filipesilva): figure out how to resolve these in bazel.
54+
"src/workspace/workspace_spec.ts",
55+
],
56+
),
57+
data = [
58+
"src/workspace/workspace-schema.json"
59+
],
60+
deps = [
61+
":core",
62+
":node",
63+
"@rxjs",
64+
"@rxjs//operators",
65+
# @typings: jasmine
66+
# @typings: node
67+
],
68+
)
69+
70+
jasmine_node_test(
71+
name = "core_test",
72+
srcs = [":core_test_lib"],
73+
)
74+
75+
76+
# @angular-devkit/core/node
77+
3678
ts_library(
3779
name = "node",
3880
srcs = glob(
3981
include = ["node/**/*.ts"],
4082
exclude = [
83+
"node/testing/**/*.ts",
4184
"node/**/*_spec.ts",
4285
"node/**/*_spec_large.ts",
43-
"tools/**/*_benchmark.ts",
86+
"node/**/*_benchmark.ts",
4487
],
4588
),
4689
module_name = "@angular-devkit/core/node",
47-
module_root = "node",
90+
module_root = "node/index.d.ts",
4891
deps = [
49-
"//packages/angular_devkit/core",
92+
":core",
5093
"@rxjs",
5194
"@rxjs//operators",
5295
# @typings: node
5396
],
5497
)
5598

5699
ts_library(
57-
name = "spec",
100+
name = "node_test_lib",
58101
srcs = glob(
59102
include = [
60-
"**/*_spec.ts",
61-
"**/*_spec_large.ts",
103+
"node/**/*_spec.ts",
104+
"node/**/*_spec_large.ts",
105+
],
106+
exclude = [
107+
# The node resolve spec uses the _devKitRoot global, which isn't available in Bazel.
108+
# TODO(@filipesilva): figure out an alternative to that global.
109+
"node/resolve_spec.ts",
62110
],
63111
),
64112
deps = [
@@ -70,3 +118,32 @@ ts_library(
70118
# @typings: node
71119
],
72120
)
121+
122+
jasmine_node_test(
123+
name = "node_test",
124+
srcs = [":node_test_lib"],
125+
)
126+
127+
128+
# @angular-devkit/core/node/testing
129+
130+
ts_library(
131+
name = "node_testing",
132+
srcs = glob(
133+
include = ["node/testing/**/*.ts"],
134+
exclude = [
135+
"node/testing/**/*_spec.ts",
136+
"node/testing/**/*_spec_large.ts",
137+
"node/testing/**/*_benchmark.ts",
138+
],
139+
),
140+
module_name = "@angular-devkit/core/node/testing",
141+
module_root = "node/testing/index.d.ts",
142+
deps = [
143+
":core",
144+
":node",
145+
"@rxjs",
146+
"@rxjs//operators",
147+
# @typings: node
148+
],
149+
)

0 commit comments

Comments
 (0)