mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
test: remove DENO_FUTURE
(#25587)
This commit is contained in:
parent
57556ade8c
commit
3285801429
8 changed files with 11 additions and 117 deletions
|
@ -9,7 +9,6 @@ import {
|
|||
assertStringIncludes,
|
||||
assertThrows,
|
||||
delay,
|
||||
DENO_FUTURE,
|
||||
fail,
|
||||
unimplemented,
|
||||
} from "./test_util.ts";
|
||||
|
@ -1359,7 +1358,7 @@ Deno.test(
|
|||
);
|
||||
|
||||
Deno.test(
|
||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
||||
{ permissions: { read: true, net: true } },
|
||||
async function fetchCustomClientPrivateKey(): Promise<
|
||||
void
|
||||
> {
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
assertEquals,
|
||||
assertRejects,
|
||||
assertThrows,
|
||||
DENO_FUTURE,
|
||||
} from "./test_util.ts";
|
||||
import { copy } from "@std/io/copy";
|
||||
|
||||
|
@ -21,7 +20,7 @@ Deno.test(function filesStdioFileDescriptors() {
|
|||
});
|
||||
|
||||
Deno.test(
|
||||
{ ignore: DENO_FUTURE, permissions: { read: true } },
|
||||
{ permissions: { read: true } },
|
||||
async function filesCopyToStdout() {
|
||||
const filename = "tests/testdata/assets/fixture.json";
|
||||
using file = await Deno.open(filename);
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// deno-lint-ignore-file no-window-prefix no-window
|
||||
import {
|
||||
assert,
|
||||
assertEquals,
|
||||
assertRejects,
|
||||
assertThrows,
|
||||
DENO_FUTURE,
|
||||
} from "./test_util.ts";
|
||||
|
||||
Deno.test(function globalThisExists() {
|
||||
|
@ -20,34 +18,18 @@ Deno.test(function noInternalGlobals() {
|
|||
}
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function windowExists() {
|
||||
assert(window != null);
|
||||
});
|
||||
|
||||
Deno.test(function selfExists() {
|
||||
assert(self != null);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function windowWindowExists() {
|
||||
assert(window.window === window);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function windowSelfExists() {
|
||||
assert(window.self === window);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function globalThisEqualsWindow() {
|
||||
assert(globalThis === window);
|
||||
Deno.test(function globalThisWindowEqualsUndefined() {
|
||||
assert(globalThis.window === undefined);
|
||||
});
|
||||
|
||||
Deno.test(function globalThisEqualsSelf() {
|
||||
assert(globalThis === self);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function globalThisInstanceofWindow() {
|
||||
assert(globalThis instanceof Window);
|
||||
});
|
||||
|
||||
Deno.test(function globalThisConstructorLength() {
|
||||
assert(globalThis.constructor.length === 0);
|
||||
});
|
||||
|
@ -66,10 +48,6 @@ Deno.test(function DenoNamespaceExists() {
|
|||
assert(Deno != null);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function DenoNamespaceEqualsWindowDeno() {
|
||||
assert(Deno === window.Deno);
|
||||
});
|
||||
|
||||
Deno.test(function DenoNamespaceIsNotFrozen() {
|
||||
assert(!Object.isFrozen(Deno));
|
||||
});
|
||||
|
@ -120,11 +98,7 @@ Deno.test(async function windowQueueMicrotask() {
|
|||
res();
|
||||
};
|
||||
});
|
||||
if (DENO_FUTURE) {
|
||||
globalThis.queueMicrotask(resolve1!);
|
||||
} else {
|
||||
window.queueMicrotask(resolve1!);
|
||||
}
|
||||
globalThis.queueMicrotask(resolve1!);
|
||||
setTimeout(resolve2!, 0);
|
||||
await p1;
|
||||
await p2;
|
||||
|
@ -143,18 +117,9 @@ Deno.test(function webApiGlobalThis() {
|
|||
Deno.test(function windowNameIsDefined() {
|
||||
assertEquals(typeof globalThis.name, "string");
|
||||
assertEquals(name, "");
|
||||
if (!DENO_FUTURE) {
|
||||
assertEquals(window.name, name);
|
||||
}
|
||||
name = "foobar";
|
||||
if (!DENO_FUTURE) {
|
||||
assertEquals(window.name, "foobar");
|
||||
}
|
||||
assertEquals(name, "foobar");
|
||||
name = "";
|
||||
if (!DENO_FUTURE) {
|
||||
assertEquals(window.name, "");
|
||||
}
|
||||
assertEquals(name, "");
|
||||
});
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import {
|
|||
assertThrows,
|
||||
curlRequest,
|
||||
curlRequestWithStdErr,
|
||||
DENO_FUTURE,
|
||||
execCode,
|
||||
execCode3,
|
||||
fail,
|
||||
|
@ -20,7 +19,7 @@ import {
|
|||
} from "./test_util.ts";
|
||||
|
||||
// Since these tests may run in parallel, ensure this port is unique to this file
|
||||
const servePort = DENO_FUTURE ? 4511 : 4502;
|
||||
const servePort = 4511;
|
||||
|
||||
const {
|
||||
upgradeHttpRaw,
|
||||
|
|
|
@ -25,9 +25,6 @@ export { delay } from "@std/async/delay";
|
|||
export { readLines } from "@std/io/read-lines";
|
||||
export { parseArgs } from "@std/cli/parse-args";
|
||||
|
||||
// TODO(2.0): remove this and all the tests that depend on it.
|
||||
export const DENO_FUTURE = true;
|
||||
|
||||
export function pathToAbsoluteFileUrl(path: string): URL {
|
||||
path = resolve(path);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test({ ignore: !DENO_FUTURE }, async function timeoutBindThis() {
|
||||
Deno.test(async function timeoutBindThis() {
|
||||
const thisCheckPassed = [null, undefined, globalThis];
|
||||
|
||||
const thisCheckFailed = [
|
||||
|
|
|
@ -6,7 +6,6 @@ import {
|
|||
assertRejects,
|
||||
assertStrictEquals,
|
||||
assertThrows,
|
||||
DENO_FUTURE,
|
||||
} from "./test_util.ts";
|
||||
import { BufReader, BufWriter } from "@std/io";
|
||||
import { readAll } from "@std/io/read-all";
|
||||
|
@ -1042,7 +1041,7 @@ Deno.test(
|
|||
);
|
||||
|
||||
Deno.test(
|
||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
||||
{ permissions: { read: true, net: true } },
|
||||
async function connectTLSBadCertKey(): Promise<void> {
|
||||
await assertRejects(async () => {
|
||||
await Deno.connectTls({
|
||||
|
@ -1074,7 +1073,7 @@ Deno.test(
|
|||
);
|
||||
|
||||
Deno.test(
|
||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
||||
{ permissions: { read: true, net: true } },
|
||||
async function connectTLSNotKey(): Promise<void> {
|
||||
await assertRejects(async () => {
|
||||
await Deno.connectTls({
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// deno-lint-ignore-file no-deprecated-deno-api
|
||||
|
||||
import { assert, DENO_FUTURE } from "./test_util.ts";
|
||||
import { assert } from "./test_util.ts";
|
||||
|
||||
// Note tests for Deno.stdin.setRaw is in integration tests.
|
||||
|
||||
|
@ -15,17 +15,6 @@ Deno.test(function consoleSize() {
|
|||
assert(typeof result.rows !== "undefined");
|
||||
});
|
||||
|
||||
Deno.test(
|
||||
{ ignore: DENO_FUTURE, permissions: { read: true } },
|
||||
function isatty() {
|
||||
// CI not under TTY, so cannot test stdin/stdout/stderr.
|
||||
const f = Deno.openSync("tests/testdata/assets/hello.txt");
|
||||
// @ts-ignore `Deno.isatty()` was soft-removed in Deno 2.
|
||||
assert(!Deno.isatty(f.rid));
|
||||
f.close();
|
||||
},
|
||||
);
|
||||
|
||||
Deno.test(function isattyError() {
|
||||
let caught = false;
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue