From b72f0be27c382f2d4e5d272ce9ed2211af584d80 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 15 Feb 2024 10:20:17 +0530 Subject: chore: add DENO_FUTURE env var (#22318) Closes https://github.com/denoland/deno/issues/22315 ``` ~> DENO_FUTURE=1 target/debug/deno > globalThis.window undefined ``` --- tests/integration/run_tests.rs | 10 ++++++++++ tests/testdata/run/deno_futures_env.ts | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 tests/testdata/run/deno_futures_env.ts (limited to 'tests') diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index c9508594c..6f108f739 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -1711,6 +1711,16 @@ fn type_directives_js_main() { assert_not_contains!(output.combined_output(), "type_reference.d.ts"); } +#[test] +fn test_deno_futures_env() { + let context = TestContextBuilder::new().add_future_env_vars().build(); + let output = context + .new_command() + .args("run --quiet --reload run/deno_futures_env.ts") + .run(); + output.assert_exit_code(0); +} + itest!(type_directives_redirect { args: "run --reload --check run/type_directives_redirect.ts", output: "run/type_directives_redirect.ts.out", diff --git a/tests/testdata/run/deno_futures_env.ts b/tests/testdata/run/deno_futures_env.ts new file mode 100644 index 000000000..21f76e367 --- /dev/null +++ b/tests/testdata/run/deno_futures_env.ts @@ -0,0 +1,3 @@ +if (typeof window !== "undefined") { + throw new Error("Window global available"); +} -- cgit v1.2.3