diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index 8a24603b32..ed07fab96b 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -234,12 +234,6 @@ itest!(_044_bad_resource { exit_code: 1, }); -itest!(_045_proxy { - args: "run -L debug --allow-net --allow-env --allow-run --allow-read --reload --quiet run/045_proxy_test.ts", - output: "run/045_proxy_test.ts.out", - http_server: true, -}); - itest!(_046_tsx { args: "run --quiet --reload run/046_jsx_test.tsx", output: "run/046_jsx_test.tsx.out", diff --git a/tests/specs/run/045_proxy/__test__.jsonc b/tests/specs/run/045_proxy/__test__.jsonc new file mode 100644 index 0000000000..d4fb7f60cd --- /dev/null +++ b/tests/specs/run/045_proxy/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run -L debug --allow-net --allow-env --allow-run --allow-read --reload --quiet proxy_test.ts", + "output": "proxy_test.ts.out" +} diff --git a/tests/testdata/run/045_programmatic_proxy_client.ts b/tests/specs/run/045_proxy/programmatic_proxy_client.ts similarity index 100% rename from tests/testdata/run/045_programmatic_proxy_client.ts rename to tests/specs/run/045_proxy/programmatic_proxy_client.ts diff --git a/tests/testdata/run/045_proxy_client.ts b/tests/specs/run/045_proxy/proxy_client.ts similarity index 100% rename from tests/testdata/run/045_proxy_client.ts rename to tests/specs/run/045_proxy/proxy_client.ts diff --git a/tests/testdata/run/045_proxy_test.ts b/tests/specs/run/045_proxy/proxy_test.ts similarity index 71% rename from tests/testdata/run/045_proxy_test.ts rename to tests/specs/run/045_proxy/proxy_test.ts index fcb898c779..d3386f0d7b 100644 --- a/tests/testdata/run/045_proxy_test.ts +++ b/tests/specs/run/045_proxy/proxy_test.ts @@ -1,6 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { Server } from "../../../tests/util/std/http/server.ts"; -import { assertEquals } from "../../../tests/util/std/assert/mod.ts"; +import { Server } from "../../../util/std/http/server.ts"; const addr = Deno.args[1] || "localhost:4555"; @@ -30,25 +29,33 @@ async function handler(req: Request): Promise { }); } +function assertSuccessOutput(output: Deno.CommandOutput) { + if (output.code !== 0) { + console.error("STDOUT", new TextDecoder().decode(output.stdout)); + console.error("STDERR", new TextDecoder().decode(output.stderr)); + throw new Error(`Expected exit code 0, was ${output.code}`); + } +} + async function testFetch() { - const { code } = await new Deno.Command(Deno.execPath(), { + const output = await new Deno.Command(Deno.execPath(), { args: [ "run", "--quiet", "--reload", "--allow-net", - "run/045_proxy_client.ts", + "proxy_client.ts", ], env: { HTTP_PROXY: `http://${addr}`, }, }).output(); - assertEquals(code, 0); + assertSuccessOutput(output); } async function testModuleDownload() { - const { code } = await new Deno.Command(Deno.execPath(), { + const output = await new Deno.Command(Deno.execPath(), { args: [ "cache", "--reload", @@ -60,17 +67,17 @@ async function testModuleDownload() { }, }).output(); - assertEquals(code, 0); + assertSuccessOutput(output); } async function testFetchNoProxy() { - const { code } = await new Deno.Command(Deno.execPath(), { + const output = await new Deno.Command(Deno.execPath(), { args: [ "run", "--quiet", "--reload", "--allow-net", - "run/045_proxy_client.ts", + "proxy_client.ts", ], env: { HTTP_PROXY: "http://not.exising.proxy.server", @@ -78,11 +85,11 @@ async function testFetchNoProxy() { }, }).output(); - assertEquals(code, 0); + assertSuccessOutput(output); } async function testModuleDownloadNoProxy() { - const { code } = await new Deno.Command(Deno.execPath(), { + const output = await new Deno.Command(Deno.execPath(), { args: [ "cache", "--reload", @@ -95,21 +102,22 @@ async function testModuleDownloadNoProxy() { }, }).output(); - assertEquals(code, 0); + assertSuccessOutput(output); } async function testFetchProgrammaticProxy() { - const { code } = await new Deno.Command(Deno.execPath(), { + const output = await new Deno.Command(Deno.execPath(), { args: [ "run", "--quiet", "--reload", "--allow-net=localhost:4545,localhost:4555", "--unstable", - "run/045_programmatic_proxy_client.ts", + "programmatic_proxy_client.ts", ], }).output(); - assertEquals(code, 0); + + assertSuccessOutput(output); } proxyServer(); diff --git a/tests/testdata/run/045_proxy_test.ts.out b/tests/specs/run/045_proxy/proxy_test.ts.out similarity index 100% rename from tests/testdata/run/045_proxy_test.ts.out rename to tests/specs/run/045_proxy/proxy_test.ts.out diff --git a/tools/lint.js b/tools/lint.js index 0fe96b0490..aa3b417ccb 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -221,7 +221,7 @@ async function ensureNoNewITests() { "pm_tests.rs": 0, "publish_tests.rs": 0, "repl_tests.rs": 0, - "run_tests.rs": 373, + "run_tests.rs": 372, "shared_library_tests.rs": 0, "task_tests.rs": 30, "test_tests.rs": 77,