fix(lint): revert no-deprecated-api for Deno.run (#17880)

This commit is contained in:
David Sherret 2023-02-22 11:14:53 -05:00 committed by GitHub
parent a2d942a778
commit b4b718d6ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 4 additions and 40 deletions

View file

@ -11,7 +11,6 @@ Deno.test(
{ permissions: { read: true, run: false } },
function runPermissions() {
assertThrows(() => {
// deno-lint-ignore no-deprecated-deno-api
Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
});
@ -22,7 +21,6 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runSuccess() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
// freeze the array to ensure it's not modified
cmd: Object.freeze([
@ -45,7 +43,6 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runUrl() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
new URL(`file:///${Deno.execPath()}`),
@ -69,7 +66,6 @@ Deno.test(
async function runStdinRid0(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
stdin: 0,
@ -89,7 +85,6 @@ Deno.test(
{ permissions: { run: true, read: true } },
function runInvalidStdio() {
assertThrows(() =>
// deno-lint-ignore no-deprecated-deno-api
Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
// @ts-expect-error because Deno.run should throw on invalid stdin.
@ -97,7 +92,6 @@ Deno.test(
})
);
assertThrows(() =>
// deno-lint-ignore no-deprecated-deno-api
Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
// @ts-expect-error because Deno.run should throw on invalid stdout.
@ -105,7 +99,6 @@ Deno.test(
})
);
assertThrows(() =>
// deno-lint-ignore no-deprecated-deno-api
Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
// @ts-expect-error because Deno.run should throw on invalid stderr.
@ -118,7 +111,6 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runCommandFailedWithCode() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [Deno.execPath(), "eval", "Deno.exit(41 + 1)"],
});
@ -135,7 +127,6 @@ Deno.test(
permissions: { run: true, read: true },
},
async function runCommandFailedWithSignal() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -159,7 +150,6 @@ Deno.test(
Deno.test({ permissions: { run: true } }, function runNotFound() {
let error;
try {
// deno-lint-ignore no-deprecated-deno-api
Deno.run({ cmd: ["this file hopefully doesn't exist"] });
} catch (e) {
error = e;
@ -191,7 +181,6 @@ tryExit();
`;
Deno.writeFileSync(`${cwd}/${programFile}`, enc.encode(program));
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cwd,
cmd: [Deno.execPath(), "run", "--allow-read", programFile],
@ -215,7 +204,6 @@ Deno.test(
async function runStdinPiped(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -247,7 +235,6 @@ Deno.test(
async function runStdoutPiped(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -284,7 +271,6 @@ Deno.test(
async function runStderrPiped(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -319,7 +305,6 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runOutput() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -340,7 +325,6 @@ Deno.test(
async function runStderrOutput(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -366,7 +350,6 @@ Deno.test(
write: true,
});
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -399,7 +382,6 @@ Deno.test(
await Deno.writeFile(fileName, encoder.encode("hello"));
const file = await Deno.open(fileName);
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -419,7 +401,6 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runEnv() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -442,7 +423,6 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runClose() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -466,7 +446,6 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runKillAfterStatus() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [Deno.execPath(), "eval", 'console.log("hello")'],
});
@ -523,7 +502,6 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function killSuccess() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
});
@ -547,7 +525,6 @@ Deno.test(
);
Deno.test({ permissions: { run: true, read: true } }, function killFailed() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
});
@ -565,7 +542,6 @@ Deno.test({ permissions: { run: true, read: true } }, function killFailed() {
Deno.test(
{ permissions: { run: true, read: true, env: true } },
async function clearEnv(): Promise<void> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -598,7 +574,6 @@ Deno.test(
ignore: Deno.build.os === "windows",
},
async function uid(): Promise<void> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
"id",
@ -612,7 +587,6 @@ Deno.test(
if (currentUid !== "0") {
assertThrows(() => {
// deno-lint-ignore no-deprecated-deno-api
Deno.run({
cmd: [
"echo",
@ -631,7 +605,6 @@ Deno.test(
ignore: Deno.build.os === "windows",
},
async function gid(): Promise<void> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
"id",
@ -645,7 +618,6 @@ Deno.test(
if (currentGid !== "0") {
assertThrows(() => {
// deno-lint-ignore no-deprecated-deno-api
Deno.run({
cmd: [
"echo",
@ -664,7 +636,6 @@ Deno.test(
ignore: Deno.build.os === "windows",
},
async function non_existent_cwd(): Promise<void> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd: [
Deno.execPath(),