Skip to content

Commit

Permalink
test: copy_to_bin shenanigans for Windows CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Apr 29, 2020
1 parent 199acf4 commit 3e13dbe
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
10 changes: 9 additions & 1 deletion internal/linker/test/issue_1823/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load(":ts_jest_test.bzl", "ts_jest_test")

Expand All @@ -10,12 +11,19 @@ ts_library(
],
)

# Shenanigans for Windows which doesn't have runfiles symlinks
# We need the jest config to be in the output tree where the specs are
copy_to_bin(
name = "jest_config",
srcs = ["jest.config.js"],
)

ts_jest_test(
name = "test",
srcs = [
"lib.test.ts",
],
jest_config = "jest.config.js",
jest_config = ":jest_config",
deps = [
":lib",
],
Expand Down
4 changes: 2 additions & 2 deletions internal/linker/test/issue_1823/ts_jest_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Uses ts_library devmode UMD output"""
"--no-watchman",
"--ci",
]
args.extend(["--config", "$(rootpath %s)" % jest_config])
args.extend(["--config", "$$(rlocation $(rootpath %s))" % jest_config])

_jest_test(
name = name,
data = [jest_config, ":%s_umd" % name] + deps + data,
args = args,
templated_args = args,
**kwargs
)
23 changes: 21 additions & 2 deletions internal/linker/test/issue_1823_use_ts_library_esm/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load(":ts_jest_test.bzl", "ts_jest_test")

Expand All @@ -14,15 +15,33 @@ ts_library(
],
)

# Shenanigans for Windows which doesn't have runfiles symlinks
# We need the jest config to be in the output tree where the specs are
copy_to_bin(
name = "jest_config",
srcs = [
"jest.config.js",
],
)

# Same goes for babelrc. We can't add it to the jest_config copy_to_bin
# since must be a file that is passed to jest in the --config arg.
copy_to_bin(
name = "babel_rc",
srcs = [
".babelrc",
],
)

ts_jest_test(
name = "test",
srcs = [
"lib.test.ts",
],
data = [
".babelrc",
":babel_rc",
],
jest_config = "jest.config.js",
jest_config = ":jest_config",
deps = [
":lib",
"@npm//@babel/preset-env",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Uses ts_library prodmode ems output"""
"--no-watchman",
"--ci",
]
args.extend(["--config", "$(rootpath %s)" % jest_config])
args.extend(["--config", "$$(rlocation $(rootpath %s))" % jest_config])

_jest_test(
name = name,
Expand Down

0 comments on commit 3e13dbe

Please sign in to comment.