From da5b5d4688f03e578565966b1c0634a187f7729d Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 25 Feb 2023 08:56:39 -0500 Subject: 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 +- cli/tests/testdata/package_json/basic/lib.bench.out | 10 ++++++++++ cli/tests/testdata/package_json/basic/lib.bench.ts | 7 +++++++ cli/tests/testdata/package_json/basic/lib.test.out | 8 ++++++++ cli/tests/testdata/package_json/basic/lib.test.ts | 7 +++++++ cli/tests/testdata/package_json/basic/lib.ts | 9 +++++++++ cli/tests/testdata/package_json/basic/main.bench.out | 11 ----------- cli/tests/testdata/package_json/basic/main.bench.ts | 7 ------- cli/tests/testdata/package_json/basic/main.info.out | 7 ++++--- cli/tests/testdata/package_json/basic/main.test.out | 9 --------- cli/tests/testdata/package_json/basic/main.test.ts | 7 ------- cli/tests/testdata/package_json/basic/main.ts | 12 ++---------- 14 files changed, 50 insertions(+), 50 deletions(-) create mode 100644 cli/tests/testdata/package_json/basic/lib.bench.out create mode 100644 cli/tests/testdata/package_json/basic/lib.bench.ts create mode 100644 cli/tests/testdata/package_json/basic/lib.test.out create mode 100644 cli/tests/testdata/package_json/basic/lib.test.ts create mode 100644 cli/tests/testdata/package_json/basic/lib.ts delete mode 100644 cli/tests/testdata/package_json/basic/main.bench.out delete mode 100644 cli/tests/testdata/package_json/basic/main.bench.ts delete mode 100644 cli/tests/testdata/package_json/basic/main.test.out delete mode 100644 cli/tests/testdata/package_json/basic/main.test.ts (limited to 'cli/tests') diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs index 5a010ec62..240c4b2d4 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 8b318e8e1..d52109d2b 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 ce849d92f..cef10763d 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/lib.bench.out b/cli/tests/testdata/package_json/basic/lib.bench.out new file mode 100644 index 000000000..589f17655 --- /dev/null +++ b/cli/tests/testdata/package_json/basic/lib.bench.out @@ -0,0 +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]/lib.bench.ts +cpu: [WILDCARD] +runtime: [WILDCARD] + +file:///[WILDCARD]/lib.bench.ts +[WILDCARD] +-------------------------------------------------- ----------------------------- +should add [WILDCARD] diff --git a/cli/tests/testdata/package_json/basic/lib.bench.ts b/cli/tests/testdata/package_json/basic/lib.bench.ts new file mode 100644 index 000000000..e6b79d025 --- /dev/null +++ b/cli/tests/testdata/package_json/basic/lib.bench.ts @@ -0,0 +1,7 @@ +import { add } from "./lib.ts"; + +Deno.bench("should add", () => { + if (add(1, 2) !== 3) { + throw new Error("Fail"); + } +}); diff --git a/cli/tests/testdata/package_json/basic/lib.test.out b/cli/tests/testdata/package_json/basic/lib.test.out new file mode 100644 index 000000000..f0fe89612 --- /dev/null +++ b/cli/tests/testdata/package_json/basic/lib.test.out @@ -0,0 +1,8 @@ +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]/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/lib.test.ts b/cli/tests/testdata/package_json/basic/lib.test.ts new file mode 100644 index 000000000..4e833e1f3 --- /dev/null +++ b/cli/tests/testdata/package_json/basic/lib.test.ts @@ -0,0 +1,7 @@ +import { add } from "./lib.ts"; + +Deno.test("should add", () => { + if (add(1, 2) !== 3) { + throw new Error("Fail"); + } +}); 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 000000000..1deed81f7 --- /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.bench.out b/cli/tests/testdata/package_json/basic/main.bench.out deleted file mode 100644 index db0db2114..000000000 --- a/cli/tests/testdata/package_json/basic/main.bench.out +++ /dev/null @@ -1,11 +0,0 @@ -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 -cpu: [WILDCARD] -runtime: [WILDCARD] - -file:///[WILDCARD]/main.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/main.bench.ts deleted file mode 100644 index 51bfc7bba..000000000 --- a/cli/tests/testdata/package_json/basic/main.bench.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { add } from "./main.ts"; - -Deno.bench("should add", () => { - if (add(1, 2) !== 3) { - throw new Error("Fail"); - } -}); diff --git a/cli/tests/testdata/package_json/basic/main.info.out b/cli/tests/testdata/package_json/basic/main.info.out index 48c10a0ba..bf36f4f19 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.test.out b/cli/tests/testdata/package_json/basic/main.test.out deleted file mode 100644 index b04420b3b..000000000 --- a/cli/tests/testdata/package_json/basic/main.test.out +++ /dev/null @@ -1,9 +0,0 @@ -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 -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/main.test.ts deleted file mode 100644 index 298ce1f5b..000000000 --- a/cli/tests/testdata/package_json/basic/main.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { add } from "./main.ts"; - -Deno.test("should add", () => { - if (add(1, 2) !== 3) { - throw new Error("Fail"); - } -}); diff --git a/cli/tests/testdata/package_json/basic/main.ts b/cli/tests/testdata/package_json/basic/main.ts index 5911fe32d..e241f3002 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()); -- cgit v1.2.3