mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -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,
|
assertStringIncludes,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
delay,
|
delay,
|
||||||
DENO_FUTURE,
|
|
||||||
fail,
|
fail,
|
||||||
unimplemented,
|
unimplemented,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
@ -1359,7 +1358,7 @@ Deno.test(
|
||||||
);
|
);
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
{ permissions: { read: true, net: true } },
|
||||||
async function fetchCustomClientPrivateKey(): Promise<
|
async function fetchCustomClientPrivateKey(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertRejects,
|
assertRejects,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
DENO_FUTURE,
|
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
import { copy } from "@std/io/copy";
|
import { copy } from "@std/io/copy";
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ Deno.test(function filesStdioFileDescriptors() {
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ ignore: DENO_FUTURE, permissions: { read: true } },
|
{ permissions: { read: true } },
|
||||||
async function filesCopyToStdout() {
|
async function filesCopyToStdout() {
|
||||||
const filename = "tests/testdata/assets/fixture.json";
|
const filename = "tests/testdata/assets/fixture.json";
|
||||||
using file = await Deno.open(filename);
|
using file = await Deno.open(filename);
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
// deno-lint-ignore-file no-window-prefix no-window
|
|
||||||
import {
|
import {
|
||||||
assert,
|
assert,
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertRejects,
|
assertRejects,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
DENO_FUTURE,
|
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
Deno.test(function globalThisExists() {
|
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() {
|
Deno.test(function selfExists() {
|
||||||
assert(self != null);
|
assert(self != null);
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function windowWindowExists() {
|
Deno.test(function globalThisWindowEqualsUndefined() {
|
||||||
assert(window.window === window);
|
assert(globalThis.window === undefined);
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function windowSelfExists() {
|
|
||||||
assert(window.self === window);
|
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function globalThisEqualsWindow() {
|
|
||||||
assert(globalThis === window);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test(function globalThisEqualsSelf() {
|
Deno.test(function globalThisEqualsSelf() {
|
||||||
assert(globalThis === self);
|
assert(globalThis === self);
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function globalThisInstanceofWindow() {
|
|
||||||
assert(globalThis instanceof Window);
|
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test(function globalThisConstructorLength() {
|
Deno.test(function globalThisConstructorLength() {
|
||||||
assert(globalThis.constructor.length === 0);
|
assert(globalThis.constructor.length === 0);
|
||||||
});
|
});
|
||||||
|
@ -66,10 +48,6 @@ Deno.test(function DenoNamespaceExists() {
|
||||||
assert(Deno != null);
|
assert(Deno != null);
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function DenoNamespaceEqualsWindowDeno() {
|
|
||||||
assert(Deno === window.Deno);
|
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test(function DenoNamespaceIsNotFrozen() {
|
Deno.test(function DenoNamespaceIsNotFrozen() {
|
||||||
assert(!Object.isFrozen(Deno));
|
assert(!Object.isFrozen(Deno));
|
||||||
});
|
});
|
||||||
|
@ -120,11 +98,7 @@ Deno.test(async function windowQueueMicrotask() {
|
||||||
res();
|
res();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (DENO_FUTURE) {
|
globalThis.queueMicrotask(resolve1!);
|
||||||
globalThis.queueMicrotask(resolve1!);
|
|
||||||
} else {
|
|
||||||
window.queueMicrotask(resolve1!);
|
|
||||||
}
|
|
||||||
setTimeout(resolve2!, 0);
|
setTimeout(resolve2!, 0);
|
||||||
await p1;
|
await p1;
|
||||||
await p2;
|
await p2;
|
||||||
|
@ -143,18 +117,9 @@ Deno.test(function webApiGlobalThis() {
|
||||||
Deno.test(function windowNameIsDefined() {
|
Deno.test(function windowNameIsDefined() {
|
||||||
assertEquals(typeof globalThis.name, "string");
|
assertEquals(typeof globalThis.name, "string");
|
||||||
assertEquals(name, "");
|
assertEquals(name, "");
|
||||||
if (!DENO_FUTURE) {
|
|
||||||
assertEquals(window.name, name);
|
|
||||||
}
|
|
||||||
name = "foobar";
|
name = "foobar";
|
||||||
if (!DENO_FUTURE) {
|
|
||||||
assertEquals(window.name, "foobar");
|
|
||||||
}
|
|
||||||
assertEquals(name, "foobar");
|
assertEquals(name, "foobar");
|
||||||
name = "";
|
name = "";
|
||||||
if (!DENO_FUTURE) {
|
|
||||||
assertEquals(window.name, "");
|
|
||||||
}
|
|
||||||
assertEquals(name, "");
|
assertEquals(name, "");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ import {
|
||||||
assertThrows,
|
assertThrows,
|
||||||
curlRequest,
|
curlRequest,
|
||||||
curlRequestWithStdErr,
|
curlRequestWithStdErr,
|
||||||
DENO_FUTURE,
|
|
||||||
execCode,
|
execCode,
|
||||||
execCode3,
|
execCode3,
|
||||||
fail,
|
fail,
|
||||||
|
@ -20,7 +19,7 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
// Since these tests may run in parallel, ensure this port is unique to this file
|
// 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 {
|
const {
|
||||||
upgradeHttpRaw,
|
upgradeHttpRaw,
|
||||||
|
|
|
@ -25,9 +25,6 @@ export { delay } from "@std/async/delay";
|
||||||
export { readLines } from "@std/io/read-lines";
|
export { readLines } from "@std/io/read-lines";
|
||||||
export { parseArgs } from "@std/cli/parse-args";
|
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 {
|
export function pathToAbsoluteFileUrl(path: string): URL {
|
||||||
path = resolve(path);
|
path = resolve(path);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import {
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertNotEquals,
|
assertNotEquals,
|
||||||
delay,
|
delay,
|
||||||
DENO_FUTURE,
|
|
||||||
execCode,
|
execCode,
|
||||||
unreachable,
|
unreachable,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
@ -312,62 +311,10 @@ Deno.test(async function timeoutCallbackThis() {
|
||||||
};
|
};
|
||||||
setTimeout(obj.foo, 1);
|
setTimeout(obj.foo, 1);
|
||||||
await promise;
|
await promise;
|
||||||
if (!DENO_FUTURE) {
|
assertEquals(capturedThis, globalThis);
|
||||||
assertEquals(capturedThis, window);
|
|
||||||
} else {
|
|
||||||
assertEquals(capturedThis, globalThis);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, async function timeoutBindThis() {
|
Deno.test(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() {
|
|
||||||
const thisCheckPassed = [null, undefined, globalThis];
|
const thisCheckPassed = [null, undefined, globalThis];
|
||||||
|
|
||||||
const thisCheckFailed = [
|
const thisCheckFailed = [
|
||||||
|
|
|
@ -6,7 +6,6 @@ import {
|
||||||
assertRejects,
|
assertRejects,
|
||||||
assertStrictEquals,
|
assertStrictEquals,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
DENO_FUTURE,
|
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
import { BufReader, BufWriter } from "@std/io";
|
import { BufReader, BufWriter } from "@std/io";
|
||||||
import { readAll } from "@std/io/read-all";
|
import { readAll } from "@std/io/read-all";
|
||||||
|
@ -1042,7 +1041,7 @@ Deno.test(
|
||||||
);
|
);
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
{ permissions: { read: true, net: true } },
|
||||||
async function connectTLSBadCertKey(): Promise<void> {
|
async function connectTLSBadCertKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.connectTls({
|
await Deno.connectTls({
|
||||||
|
@ -1074,7 +1073,7 @@ Deno.test(
|
||||||
);
|
);
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
{ permissions: { read: true, net: true } },
|
||||||
async function connectTLSNotKey(): Promise<void> {
|
async function connectTLSNotKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.connectTls({
|
await Deno.connectTls({
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// deno-lint-ignore-file no-deprecated-deno-api
|
// 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.
|
// Note tests for Deno.stdin.setRaw is in integration tests.
|
||||||
|
|
||||||
|
@ -15,17 +15,6 @@ Deno.test(function consoleSize() {
|
||||||
assert(typeof result.rows !== "undefined");
|
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() {
|
Deno.test(function isattyError() {
|
||||||
let caught = false;
|
let caught = false;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue