Skip to content

Commit a6028a7

Browse files
filipesilvahansl
authored andcommitted
test(@angular-devkit/core): add bazel tests
1 parent 80479bb commit a6028a7

File tree

1 file changed

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

1 file changed

+80
-7
lines changed

packages/angular_devkit/core/BUILD

Lines changed: 80 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,7 @@ ts_library(
2024
),
2125
data = glob(["**/*.json"]),
2226
module_name = "@angular-devkit/core",
23-
module_root = "src",
27+
module_root = "src/index.d.ts",
2428
deps = [
2529
"@rxjs",
2630
"@rxjs//operators",
@@ -33,32 +37,72 @@ ts_library(
3337
],
3438
)
3539

40+
ts_library(
41+
name = "core_test_lib",
42+
srcs = glob(
43+
include = [
44+
"src/**/*_spec.ts",
45+
"src/**/*_spec_large.ts",
46+
],
47+
exclude = [
48+
# The workspace spec expects workspace.json to be there, but it's not.
49+
# TODO(@filipesilva): figure out how to resolve these in bazel.
50+
"src/workspace/workspace_spec.ts",
51+
],
52+
),
53+
data = [
54+
"src/workspace/workspace-schema.json"
55+
],
56+
deps = [
57+
":core",
58+
":node",
59+
"@rxjs",
60+
"@rxjs//operators",
61+
# @typings: jasmine
62+
# @typings: node
63+
],
64+
)
65+
66+
jasmine_node_test(
67+
name = "core_test",
68+
srcs = [":core_test_lib"],
69+
)
70+
71+
72+
# @angular-devkit/core/node
73+
3674
ts_library(
3775
name = "node",
3876
srcs = glob(
3977
include = ["node/**/*.ts"],
4078
exclude = [
79+
"node/testing/**/*.ts",
4180
"node/**/*_spec.ts",
4281
"node/**/*_spec_large.ts",
43-
"tools/**/*_benchmark.ts",
82+
"node/**/*_benchmark.ts",
4483
],
4584
),
4685
module_name = "@angular-devkit/core/node",
47-
module_root = "node",
86+
module_root = "node/index.d.ts",
4887
deps = [
49-
"//packages/angular_devkit/core",
88+
":core",
5089
"@rxjs",
5190
"@rxjs//operators",
5291
# @typings: node
5392
],
5493
)
5594

5695
ts_library(
57-
name = "spec",
96+
name = "node_test_lib",
5897
srcs = glob(
5998
include = [
60-
"**/*_spec.ts",
61-
"**/*_spec_large.ts",
99+
"node/**/*_spec.ts",
100+
"node/**/*_spec_large.ts",
101+
],
102+
exclude = [
103+
# The node resolve spec uses the _devKitRoot global, which isn't available in Bazel.
104+
# TODO(@filipesilva): figure out an alternative to that global.
105+
"node/resolve_spec.ts",
62106
],
63107
),
64108
deps = [
@@ -70,3 +114,32 @@ ts_library(
70114
# @typings: node
71115
],
72116
)
117+
118+
jasmine_node_test(
119+
name = "node_test",
120+
srcs = [":node_test_lib"],
121+
)
122+
123+
124+
# @angular-devkit/core/node/testing
125+
126+
ts_library(
127+
name = "node_testing",
128+
srcs = glob(
129+
include = ["node/testing/**/*.ts"],
130+
exclude = [
131+
"node/testing/**/*_spec.ts",
132+
"node/testing/**/*_spec_large.ts",
133+
"node/testing/**/*_benchmark.ts",
134+
],
135+
),
136+
module_name = "@angular-devkit/core/node/testing",
137+
module_root = "node/testing/index.d.ts",
138+
deps = [
139+
":core",
140+
":node",
141+
"@rxjs",
142+
"@rxjs//operators",
143+
# @typings: node
144+
],
145+
)

0 commit comments

Comments
 (0)