feat: add option for process cwd (.env support)
This commit is contained in:
@@ -43,3 +43,17 @@ sh_test(
|
||||
"//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"],
|
||||
)
|
||||
|
||||
2
tests/binary_test/env.ts
Normal file
2
tests/binary_test/env.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
const value = process.env.BUN_ENV_CWD_TEST ?? "missing";
|
||||
console.log(value);
|
||||
10
tests/binary_test/run_env_binary.sh
Executable file
10
tests/binary_test/run_env_binary.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
binary="$1"
|
||||
output="$(${binary})"
|
||||
|
||||
if [[ ${output} != "from-dotenv" ]]; then
|
||||
echo "Expected .env value from entry-point directory, got: ${output}" >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user