summaryrefslogtreecommitdiff
path: root/tests/testdata
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-08-30 18:58:58 +0100
committerGitHub <noreply@github.com>2024-08-30 13:58:58 -0400
commitb1c6142f741a507ba6594ab174065e00213100b9 (patch)
treef3dce3e55e4b10b6cf0570dddb6f69340da7a0cf /tests/testdata
parent4639ae655e9db396fdf4408961db59372334b69b (diff)
BREAKING: `DENO_FUTURE=1` by default, or welcome to Deno 2.0 (#25213)
This commit effectively turns Deno into Deno 2.0. This is done by forcing `DENO_FUTURE=1` env var, that was available in the past few months to try Deno 2 changes. This commit contains several breaking changes scheduled for Deno 2: - all deprecated JavaScript APIs are not available any more, mostly `Deno.*` APIs - `window` global is removed - FFI, WebGPU and FS APIs are now stable and don't require `--unstable-*` flags - import assertions are no longer supported - "bring your own node modules" is enabled by default This is the first commit in a series that are scheduled before the Deno 2 release. Follow up work is tracked in https://github.com/denoland/deno/issues/25241. --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com> Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com> Co-authored-by: Nathan Whitaker <nathan@deno.com>
Diffstat (limited to 'tests/testdata')
-rw-r--r--tests/testdata/npm/compare_globals/main.out22
-rw-r--r--tests/testdata/npm/compare_globals/main.ts25
2 files changed, 26 insertions, 21 deletions
diff --git a/tests/testdata/npm/compare_globals/main.out b/tests/testdata/npm/compare_globals/main.out
index 9c9c2203a..5b1d26464 100644
--- a/tests/testdata/npm/compare_globals/main.out
+++ b/tests/testdata/npm/compare_globals/main.out
@@ -10,21 +10,21 @@ Check file:///[WILDCARD]/npm/compare_globals/main.ts
true
true
[]
-false
-function
-function
-function
-undefined
-false
-false
-true
-true
-true
-true
+setTimeout 1 false
+setTimeout 2 function
+setTimeout 3 function
+setTimeout 4 function
+setTimeout 5 undefined
+process 1 false
+process 2 false
true
true
+window 1 false
+window 2 false
false
false
+self 1 true
+self 2 true
false
false
bar
diff --git a/tests/testdata/npm/compare_globals/main.ts b/tests/testdata/npm/compare_globals/main.ts
index 5d082386f..5019a5fd5 100644
--- a/tests/testdata/npm/compare_globals/main.ts
+++ b/tests/testdata/npm/compare_globals/main.ts
@@ -17,36 +17,41 @@ controller.abort("reason"); // in the NodeJS declaration it doesn't have a reaso
// Some globals are not the same between Node and Deno.
// @ts-expect-error incompatible types between Node and Deno
-console.log(globalThis.setTimeout === globals.getSetTimeout());
+console.log("setTimeout 1", globalThis.setTimeout === globals.getSetTimeout());
// Super edge case where some Node code deletes a global where the
// Node code has its own global and the Deno code has the same global,
// but it's different. Basically if some Node code deletes
// one of these globals then we don't want it to suddenly inherit
// the Deno global (or touch the Deno global at all).
-console.log(typeof globalThis.setTimeout);
-console.log(typeof globals.getSetTimeout());
+console.log("setTimeout 2", typeof globalThis.setTimeout);
+console.log("setTimeout 3", typeof globals.getSetTimeout());
globals.deleteSetTimeout();
-console.log(typeof globalThis.setTimeout);
-console.log(typeof globals.getSetTimeout());
+console.log("setTimeout 4", typeof globalThis.setTimeout);
+console.log("setTimeout 5", typeof globals.getSetTimeout());
// In Deno, the process global is not defined, but in Node it is.
-console.log("process" in globalThis);
+console.log("process 1", "process" in globalThis);
console.log(
+ "process 2",
Object.getOwnPropertyDescriptor(globalThis, "process") !== undefined,
);
globals.checkProcessGlobal();
-// In Deno, the window and self globals are defined, but in Node they are not.
-console.log("window" in globalThis);
-console.log("self" in globalThis);
+// In Deno 2 and Node.js, the window global is not defined.
+console.log("window 1", "window" in globalThis);
console.log(
+ "window 2",
Object.getOwnPropertyDescriptor(globalThis, "window") !== undefined,
);
+globals.checkWindowGlobal();
+
+// In Deno 2 self global is defined, but in Node it is not.
+console.log("self 1", "self" in globalThis);
console.log(
+ "self 2",
Object.getOwnPropertyDescriptor(globalThis, "self") !== undefined,
);
-globals.checkWindowGlobal();
globals.checkSelfGlobal();
// "Non-managed" globals are shared between Node and Deno.