summaryrefslogtreecommitdiff
path: root/tests/unit/timers_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-08-16 00:30:06 +0100
committerGitHub <noreply@github.com>2024-08-15 23:30:06 +0000
commitb6c74aab240430fa70c057be825ce766d2314e02 (patch)
tree6e2b3f690411f41de77972339f4145d2c85b31b8 /tests/unit/timers_test.ts
parenta58494483a2c618636697e05f9c799b03e405056 (diff)
Revert "test: run unit tests with DENO_FUTURE=1 (#24400)" (#25060)
This reverts commit 22a834ff5b4b312b8f91be8991f2b495d49fad2f. Appears this commit might have broken tests on `main`.
Diffstat (limited to 'tests/unit/timers_test.ts')
-rw-r--r--tests/unit/timers_test.ts59
1 files changed, 3 insertions, 56 deletions
diff --git a/tests/unit/timers_test.ts b/tests/unit/timers_test.ts
index 679e57df7..6e829c07f 100644
--- a/tests/unit/timers_test.ts
+++ b/tests/unit/timers_test.ts
@@ -4,7 +4,6 @@ import {
assertEquals,
assertNotEquals,
delay,
- DENO_FUTURE,
execCode,
unreachable,
} from "./test_util.ts";
@@ -309,63 +308,11 @@ Deno.test(async function timeoutCallbackThis() {
};
setTimeout(obj.foo, 1);
await promise;
- if (!DENO_FUTURE) {
- assertEquals(capturedThis, window);
- } else {
- assertEquals(capturedThis, globalThis);
- }
-});
-
-Deno.test({ ignore: DENO_FUTURE }, async function timeoutBindThis() {
- const thisCheckPassed = [null, undefined, globalThis, window];
-
- const thisCheckFailed = [
- 0,
- "",
- true,
- false,
- {},
- [],
- "foo",
- () => {},
- Object.prototype,
- ];
-
- for (const thisArg of thisCheckPassed) {
- const { promise, resolve } = Promise.withResolvers<void>();
- let hasThrown = 0;
- try {
- setTimeout.call(thisArg, () => resolve(), 1);
- hasThrown = 1;
- } catch (err) {
- if (err instanceof TypeError) {
- hasThrown = 2;
- } else {
- hasThrown = 3;
- }
- }
- await promise;
- assertEquals(hasThrown, 1);
- }
-
- for (const thisArg of thisCheckFailed) {
- let hasThrown = 0;
- try {
- setTimeout.call(thisArg, () => {}, 1);
- hasThrown = 1;
- } catch (err) {
- if (err instanceof TypeError) {
- hasThrown = 2;
- } else {
- hasThrown = 3;
- }
- }
- assertEquals(hasThrown, 2);
- }
+ assertEquals(capturedThis, window);
});
-Deno.test({ ignore: !DENO_FUTURE }, async function timeoutBindThis() {
- const thisCheckPassed = [null, undefined, globalThis];
+Deno.test(async function timeoutBindThis() {
+ const thisCheckPassed = [null, undefined, window, globalThis];
const thisCheckFailed = [
0,