Skip to content

Commit

Permalink
test: test fix for nodejs_binary entry point logic #1739
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Mar 26, 2020
1 parent 8644816 commit 92b7c85
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions internal/node/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "nodejs_test", "npm_package_bin")
load("@build_bazel_rules_nodejs//internal/golden_file_test:golden_file_test.bzl", "golden_file_test")
load("@npm//typescript:index.bzl", "tsc")
load("//internal/js_library:js_library.bzl", "js_library")
load("//internal/node:node_repositories.bzl", "BUILT_IN_NODE_PLATFORMS")
load("//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file")
Expand Down Expand Up @@ -342,3 +343,28 @@ nodejs_test(
entry_point = "empty_args_fail.js",
expected_exit_code = 0,
)

tsc(
name = "main_lib",
outs = [
"main.js",
],
args = [
"-p",
"$(execpath tsconfig.json)",
"--outDir",
# $(RULEDIR) is a shorthand for the dist/bin directory where Bazel requires we write outputs
"$(RULEDIR)",
],
data = [
"main.ts",
"tsconfig.json",
],
)

nodejs_test(
name = "main_test",
data = [":main_lib"],
entry_point = ":main.js",
templated_args = ["--nobazel_patch_module_resolver"],
)
1 change: 1 addition & 0 deletions internal/node/test/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('hello world' as string);
3 changes: 3 additions & 0 deletions internal/node/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"include": ["main.ts"]
}

0 comments on commit 92b7c85

Please sign in to comment.