generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathBUILD.bazel
78 lines (67 loc) · 1.74 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Test data file copying behavior. See
#
# https://github.com/aspect-build/rules_ts/issues/411
# https://github.com/aspect-build/rules_ts/issues/716
#
# Ideally, the behaviors with and without `transpiler` would align, but that is
# backwards incompatible.
load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file")
load("@aspect_bazel_lib//lib:testing.bzl", "assert_contains")
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_run_binary")
load("//ts:defs.bzl", "ts_project")
load("//ts/test:mock_transpiler.bzl", "mock")
copy_file(
name = "no_transpiler_src",
src = "check_has_data.ts",
out = "no_transpiler.ts",
)
ts_project(
name = "no_transpiler",
srcs = ["no_transpiler.ts"],
data = ["data.txt"],
tsconfig = {},
)
js_binary(
name = "no_transpiler_bin",
data = [":no_transpiler"],
entry_point = "no_transpiler.ts",
)
js_run_binary(
name = "no_transpiler_gen",
chdir = package_name(),
stdout = "no_transpiler_out.txt",
tool = ":no_transpiler_bin",
)
assert_contains(
name = "no_transpiler_test",
actual = "no_transpiler_out.txt",
expected = "false",
)
copy_file(
name = "with_transpiler_src",
src = "check_has_data.ts",
out = "with_transpiler.ts",
)
ts_project(
name = "with_transpiler",
srcs = ["with_transpiler.ts"],
data = ["data.txt"],
transpiler = mock,
tsconfig = {},
)
js_binary(
name = "with_transpiler_bin",
data = [":with_transpiler"],
entry_point = "with_transpiler.js",
)
js_run_binary(
name = "with_transpiler_gen",
chdir = package_name(),
stdout = "with_transpiler_out.txt",
tool = ":with_transpiler_bin",
)
assert_contains(
name = "with_transpiler_test",
actual = "with_transpiler_out.txt",
expected = "true",
)