summaryrefslogtreecommitdiff
path: root/tests/unit/timers_test.ts
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-09-12 11:30:12 +1000
committerGitHub <noreply@github.com>2024-09-12 11:30:12 +1000
commit3285801429eb7a40e022b571b7e3007c3e60250c (patch)
tree2ddd6c9757a9753b4cd0c21cd93f68937b79b1ab /tests/unit/timers_test.ts
parent57556ade8c128aeea7340d463b35c86afe1fb4f7 (diff)
test: remove `DENO_FUTURE` (#25587)
Diffstat (limited to 'tests/unit/timers_test.ts')
-rw-r--r--tests/unit/timers_test.ts57
1 files changed, 2 insertions, 55 deletions
diff --git a/tests/unit/timers_test.ts b/tests/unit/timers_test.ts
index 212f197cc..580d8c524 100644
--- a/tests/unit/timers_test.ts
+++ b/tests/unit/timers_test.ts
@@ -7,7 +7,6 @@ import {
assertEquals,
assertNotEquals,
delay,
- DENO_FUTURE,
execCode,
unreachable,
} from "./test_util.ts";
@@ -312,62 +311,10 @@ 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, globalThis);
});
-Deno.test({ ignore: !DENO_FUTURE }, async function timeoutBindThis() {
+Deno.test(async function timeoutBindThis() {
const thisCheckPassed = [null, undefined, globalThis];
const thisCheckFailed = [