From da5b5d4688f03e578565966b1c0634a187f7729d Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 25 Feb 2023 08:56:39 -0500 Subject: [PATCH] chore: fix flaky package_json_basic tests (#17940) https://github.com/denoland/deno/actions/runs/4267836955/jobs/7429836369 Closes #17946 --- cli/tests/integration/bench_tests.rs | 2 +- cli/tests/integration/test_tests.rs | 2 +- cli/tests/testdata/package_json/basic/fail_check.ts | 2 +- .../basic/{main.bench.out => lib.bench.out} | 5 ++--- .../basic/{main.bench.ts => lib.bench.ts} | 2 +- .../basic/{main.test.out => lib.test.out} | 5 ++--- .../package_json/basic/{main.test.ts => lib.test.ts} | 2 +- cli/tests/testdata/package_json/basic/lib.ts | 9 +++++++++ cli/tests/testdata/package_json/basic/main.info.out | 7 ++++--- cli/tests/testdata/package_json/basic/main.ts | 12 ++---------- 10 files changed, 24 insertions(+), 24 deletions(-) rename cli/tests/testdata/package_json/basic/{main.bench.out => lib.bench.out} (79%) rename cli/tests/testdata/package_json/basic/{main.bench.ts => lib.bench.ts} (74%) rename cli/tests/testdata/package_json/basic/{main.test.out => lib.test.out} (71%) rename cli/tests/testdata/package_json/basic/{main.test.ts => lib.test.ts} (74%) create mode 100644 cli/tests/testdata/package_json/basic/lib.ts diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs index 5a010ec629..240c4b2d4d 100644 --- a/cli/tests/integration/bench_tests.rs +++ b/cli/tests/integration/bench_tests.rs @@ -220,7 +220,7 @@ fn file_protocol() { itest!(package_json_basic { args: "bench", - output: "package_json/basic/main.bench.out", + output: "package_json/basic/lib.bench.out", envs: env_vars_for_npm_tests(), http_server: true, cwd: Some("package_json/basic"), diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index 8b318e8e14..d52109d2ba 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -456,7 +456,7 @@ itest!(parallel_output { itest!(package_json_basic { args: "test", - output: "package_json/basic/main.test.out", + output: "package_json/basic/lib.test.out", envs: env_vars_for_npm_tests(), http_server: true, cwd: Some("package_json/basic"), diff --git a/cli/tests/testdata/package_json/basic/fail_check.ts b/cli/tests/testdata/package_json/basic/fail_check.ts index ce849d92fb..cef10763d4 100644 --- a/cli/tests/testdata/package_json/basic/fail_check.ts +++ b/cli/tests/testdata/package_json/basic/fail_check.ts @@ -1,3 +1,3 @@ -import { getValue } from "./main.ts"; +import { getValue } from "./lib.ts"; const _test: string = getValue(); diff --git a/cli/tests/testdata/package_json/basic/main.bench.out b/cli/tests/testdata/package_json/basic/lib.bench.out similarity index 79% rename from cli/tests/testdata/package_json/basic/main.bench.out rename to cli/tests/testdata/package_json/basic/lib.bench.out index db0db21147..589f17655d 100644 --- a/cli/tests/testdata/package_json/basic/main.bench.out +++ b/cli/tests/testdata/package_json/basic/lib.bench.out @@ -1,11 +1,10 @@ Download http://localhost:4545/npm/registry/@denotest/esm-basic Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz -Check file:///[WILDCARD]/main.bench.ts -0 +Check file:///[WILDCARD]/lib.bench.ts cpu: [WILDCARD] runtime: [WILDCARD] -file:///[WILDCARD]/main.bench.ts +file:///[WILDCARD]/lib.bench.ts [WILDCARD] -------------------------------------------------- ----------------------------- should add [WILDCARD] diff --git a/cli/tests/testdata/package_json/basic/main.bench.ts b/cli/tests/testdata/package_json/basic/lib.bench.ts similarity index 74% rename from cli/tests/testdata/package_json/basic/main.bench.ts rename to cli/tests/testdata/package_json/basic/lib.bench.ts index 51bfc7bba1..e6b79d0256 100644 --- a/cli/tests/testdata/package_json/basic/main.bench.ts +++ b/cli/tests/testdata/package_json/basic/lib.bench.ts @@ -1,4 +1,4 @@ -import { add } from "./main.ts"; +import { add } from "./lib.ts"; Deno.bench("should add", () => { if (add(1, 2) !== 3) { diff --git a/cli/tests/testdata/package_json/basic/main.test.out b/cli/tests/testdata/package_json/basic/lib.test.out similarity index 71% rename from cli/tests/testdata/package_json/basic/main.test.out rename to cli/tests/testdata/package_json/basic/lib.test.out index b04420b3bc..f0fe896120 100644 --- a/cli/tests/testdata/package_json/basic/main.test.out +++ b/cli/tests/testdata/package_json/basic/lib.test.out @@ -1,8 +1,7 @@ Download http://localhost:4545/npm/registry/@denotest/esm-basic Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz -Check file://[WILDCARD]/main.test.ts -0 -running 1 test from [WILDCARD]main.test.ts +Check file://[WILDCARD]/lib.test.ts +running 1 test from [WILDCARD]lib.test.ts should add ... ok ([WILDCARD]) ok | 1 passed | 0 failed ([WILDCARD]) diff --git a/cli/tests/testdata/package_json/basic/main.test.ts b/cli/tests/testdata/package_json/basic/lib.test.ts similarity index 74% rename from cli/tests/testdata/package_json/basic/main.test.ts rename to cli/tests/testdata/package_json/basic/lib.test.ts index 298ce1f5be..4e833e1f33 100644 --- a/cli/tests/testdata/package_json/basic/main.test.ts +++ b/cli/tests/testdata/package_json/basic/lib.test.ts @@ -1,4 +1,4 @@ -import { add } from "./main.ts"; +import { add } from "./lib.ts"; Deno.test("should add", () => { if (add(1, 2) !== 3) { diff --git a/cli/tests/testdata/package_json/basic/lib.ts b/cli/tests/testdata/package_json/basic/lib.ts new file mode 100644 index 0000000000..1deed81f7e --- /dev/null +++ b/cli/tests/testdata/package_json/basic/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/cli/tests/testdata/package_json/basic/main.info.out b/cli/tests/testdata/package_json/basic/main.info.out index 48c10a0bae..bf36f4f19e 100644 --- a/cli/tests/testdata/package_json/basic/main.info.out +++ b/cli/tests/testdata/package_json/basic/main.info.out @@ -1,7 +1,8 @@ local: [WILDCARD]main.ts type: TypeScript -dependencies: 1 unique +dependencies: 2 unique size: [WILDCARD] -file://[WILDCARD]/package_json/basic/main.ts ([WILDCARD]) -└── npm:@denotest/esm-basic@1.0.0 ([WILDCARD]) +file:///[WILDCARD]/main.ts (63B) +└─┬ file:///[WILDCARD]/lib.ts (166B) + └── npm:@denotest/esm-basic@1.0.0 (345B) diff --git a/cli/tests/testdata/package_json/basic/main.ts b/cli/tests/testdata/package_json/basic/main.ts index 5911fe32d0..e241f30026 100644 --- a/cli/tests/testdata/package_json/basic/main.ts +++ b/cli/tests/testdata/package_json/basic/main.ts @@ -1,11 +1,3 @@ -import * as test from "@denotest/esm-basic"; +import { getValue } from "./lib.ts"; -console.log(test.getValue()); - -export function add(a: number, b: number) { - return a + b; -} - -export function getValue() { - return test.getValue(); -} +console.log(getValue());