From 71e4ac774bc18902a0d23f29d9b18b43b19bbbf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 3 Sep 2024 10:07:02 +0100 Subject: BREAKING(unstable): drop support for Deno.run.{clearEnv,gid,uid} (#25371) These are unstable options and the APIs is now deprecated. To limit amount of unstable flags we elected to have these APIs removed. --- tests/unit/process_test.ts | 96 ---------------------------------------------- 1 file changed, 96 deletions(-) (limited to 'tests') diff --git a/tests/unit/process_test.ts b/tests/unit/process_test.ts index 799c8d12c..a35362d09 100644 --- a/tests/unit/process_test.ts +++ b/tests/unit/process_test.ts @@ -582,102 +582,6 @@ Deno.test({ permissions: { run: true, read: true } }, function killFailed() { p.close(); }); -Deno.test( - { permissions: { run: true, read: true, env: true } }, - async function clearEnv(): Promise { - // deno-lint-ignore no-deprecated-deno-api - const p = Deno.run({ - cmd: [ - Deno.execPath(), - "eval", - "-p", - "JSON.stringify(Deno.env.toObject())", - ], - stdout: "piped", - clearEnv: true, - env: { - FOO: "23147", - }, - }); - - const obj = JSON.parse(new TextDecoder().decode(await p.output())); - - // can't check for object equality because the OS may set additional env - // vars for processes, so we check if PATH isn't present as that is a common - // env var across OS's and isn't set for processes. - assertEquals(obj.FOO, "23147"); - assert(!("PATH" in obj)); - - p.close(); - }, -); - -Deno.test( - { - permissions: { run: true, read: true }, - ignore: Deno.build.os === "windows", - }, - async function uid(): Promise { - // deno-lint-ignore no-deprecated-deno-api - const p = Deno.run({ - cmd: [ - "id", - "-u", - ], - stdout: "piped", - }); - - const currentUid = new TextDecoder().decode(await p.output()); - p.close(); - - if (currentUid !== "0") { - assertThrows(() => { - // deno-lint-ignore no-deprecated-deno-api - Deno.run({ - cmd: [ - "echo", - "fhqwhgads", - ], - uid: 0, - }); - }, Deno.errors.PermissionDenied); - } - }, -); - -Deno.test( - { - permissions: { run: true, read: true }, - ignore: Deno.build.os === "windows", - }, - async function gid(): Promise { - // deno-lint-ignore no-deprecated-deno-api - const p = Deno.run({ - cmd: [ - "id", - "-g", - ], - stdout: "piped", - }); - - const currentGid = new TextDecoder().decode(await p.output()); - p.close(); - - if (currentGid !== "0") { - assertThrows(() => { - // deno-lint-ignore no-deprecated-deno-api - Deno.run({ - cmd: [ - "echo", - "fhqwhgads", - ], - gid: 0, - }); - }, Deno.errors.PermissionDenied); - } - }, -); - Deno.test( { permissions: { run: true, read: true, write: true }, -- cgit v1.2.3