Files
rules_bun/tests/binary_test/BUILD.bazel
eric b35f03872c
Some checks failed
CI / test (ubuntu-latest, linux-x64) (pull_request) Failing after 32s
CI / test (macos-14, darwin-arm64) (pull_request) Has been cancelled
CI / test (windows-latest, windows) (pull_request) Has been cancelled
test: add more tests
2026-03-15 00:59:58 +01:00

120 lines
2.6 KiB
Python

load("//bun:defs.bzl", "bun_binary")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
bun_binary(
name = "hello_js_bin",
entry_point = "hello.js",
)
sh_test(
name = "bun_binary_js_test",
srcs = ["run_binary.sh"],
args = ["$(location :hello_js_bin)", "hello-js"],
data = [":hello_js_bin"],
)
bun_binary(
name = "hello_ts_bin",
entry_point = "hello.ts",
)
sh_test(
name = "bun_binary_ts_test",
srcs = ["run_binary.sh"],
args = ["$(location :hello_ts_bin)", "hello-ts"],
data = [":hello_ts_bin"],
)
bun_binary(
name = "hello_js_with_data_bin",
entry_point = "hello.js",
data = ["payload.txt"],
)
sh_test(
name = "bun_binary_data_test",
srcs = ["verify_data_shape.sh"],
args = [
"$(location //internal:bun_binary.bzl)",
"$(location //tests/binary_test:BUILD.bazel)",
],
data = [
"//internal:bun_binary.bzl",
"//tests/binary_test:BUILD.bazel",
],
)
bun_binary(
name = "env_cwd_bin",
entry_point = "env.ts",
data = [".env"],
working_dir = "entry_point",
)
sh_test(
name = "bun_binary_env_cwd_test",
srcs = ["run_env_binary.sh"],
args = ["$(location :env_cwd_bin)"],
data = [":env_cwd_bin"],
)
bun_binary(
name = "env_parent_cwd_bin",
entry_point = "env_parent/src/main.ts",
data = ["env_parent/.env"],
working_dir = "entry_point",
)
sh_test(
name = "bun_binary_env_parent_cwd_test",
srcs = ["run_parent_env_binary.sh"],
args = ["$(location :env_parent_cwd_bin)"],
data = [":env_parent_cwd_bin"],
)
bun_binary(
name = "runtime_flag_bin",
entry_point = "flag_probe.ts",
args = ["one", "two"],
preload = ["preload.ts"],
env_files = ["runtime.env"],
)
sh_test(
name = "bun_binary_runtime_flags_test",
srcs = ["run_flag_binary.sh"],
args = ["$(location :runtime_flag_bin)"],
data = [":runtime_flag_bin"],
)
sh_test(
name = "bun_binary_runtime_flags_shape_test",
srcs = ["verify_runtime_flags_shape.sh"],
args = ["$(location :runtime_flag_bin)"],
data = [":runtime_flag_bin"],
)
bun_binary(
name = "configured_launcher_bin",
entry_point = "hello.ts",
node_modules = "@script_test_vite_node_modules//:node_modules",
smol = True,
conditions = [
"browser",
"development",
],
install_mode = "force",
run_flags = [
"--hot",
"--console-depth",
"4",
],
)
sh_test(
name = "bun_binary_configured_launcher_shape_test",
srcs = ["verify_configured_launcher_shape.sh"],
args = ["$(location :configured_launcher_bin)"],
data = [":configured_launcher_bin"],
)