-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.bzl
29 lines (26 loc) · 835 Bytes
/
jest.bzl
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
load("@npm//jest-cli:index.bzl", "jest", _jest_test = "jest_test")
def jest_test(name, srcs, deps, jest_config, **kwargs):
"A macro around the autogenerated jest_test rule"
templated_args = [
"--no-cache",
"--no-watchman",
"--ci",
"--colors",
]
templated_args.extend(["--config", "$(rootpath %s)" % jest_config])
for src in srcs:
templated_args.extend(["--runTestsByPath", "$(rootpaths %s)" % src])
data = [jest_config] + srcs + deps
_jest_test(
name = name,
data = data,
templated_args = templated_args,
**kwargs
)
# This rule is used specifically to update snapshots via `bazel run`
jest(
name = "%s.update" % name,
data = data,
templated_args = templated_args + ["-u"],
**kwargs
)