diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2022-08-04 17:38:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-04 12:38:40 -0400 |
commit | 34328690dc2090fd9282337aca1df74cbf837cab (patch) | |
tree | e2a266d39f6ab9326b10946f18c4c73a02f97185 /cli/tests/testdata/test | |
parent | e1297b1a285801f3c3ee911ddbd0afde153a8b6f (diff) |
fix(test): output parallel test results independently (#15399)
Diffstat (limited to 'cli/tests/testdata/test')
-rw-r--r-- | cli/tests/testdata/test/parallel_output.out | 57 | ||||
-rw-r--r-- | cli/tests/testdata/test/parallel_output.ts | 27 | ||||
-rw-r--r-- | cli/tests/testdata/test/short-pass-jobs-flag-warning.out | 3 | ||||
-rw-r--r-- | cli/tests/testdata/test/short-pass.out | 3 | ||||
-rw-r--r-- | cli/tests/testdata/test/steps/output_within.out | 2 |
5 files changed, 86 insertions, 6 deletions
diff --git a/cli/tests/testdata/test/parallel_output.out b/cli/tests/testdata/test/parallel_output.out new file mode 100644 index 000000000..3ec9c5221 --- /dev/null +++ b/cli/tests/testdata/test/parallel_output.out @@ -0,0 +1,57 @@ +Check [WILDCARD]/test/parallel_output.ts +./test/parallel_output.ts => step output ... step 1 ... ok ([WILDCARD]ms) +./test/parallel_output.ts => step output ... step 2 ... ok ([WILDCARD]ms) +------- output ------- +Hello, world! (from step 3) +----- output end ----- +./test/parallel_output.ts => step output ... step 3 ... ok ([WILDCARD]ms) +------- output ------- +Hello, world! (from step 4) +----- output end ----- +./test/parallel_output.ts => step output ... step 4 ... ok ([WILDCARD]ms) +./test/parallel_output.ts => step output ... ok ([WILDCARD]ms) +./test/parallel_output.ts => step failures ... step 1 ... ok ([WILDCARD]ms) +./test/parallel_output.ts => step failures ... step 2 ... FAILED ([WILDCARD]ms) + error: Error: Fail. + throw new Error("Fail."); + ^ + at file:///[WILDCARD]/test/parallel_output.ts:15:11 + at [WILDCARD] + at file:///[WILDCARD]/test/parallel_output.ts:14:11 +./test/parallel_output.ts => step failures ... step 3 ... FAILED ([WILDCARD]ms) + error: Error: Fail. + await t.step("step 3", () => Promise.reject(new Error("Fail."))); + ^ + at file:///[WILDCARD]/test/parallel_output.ts:17:47 + at [WILDCARD] + at file:///[WILDCARD]/test/parallel_output.ts:17:11 +./test/parallel_output.ts => step failures ... FAILED ([WILDCARD]ms) +./test/parallel_output.ts => step nested failure ... step 1 ... inner 1 ... ok ([WILDCARD]ms) +./test/parallel_output.ts => step nested failure ... step 1 ... inner 2 ... FAILED ([WILDCARD]ms) + error: Error: Failed. + throw new Error("Failed."); + ^ + at file:///[WILDCARD]/test/parallel_output.ts:24:13 + at [WILDCARD] + at file:///[WILDCARD]/test/parallel_output.ts:23:13 +./test/parallel_output.ts => step nested failure ... step 1 ... FAILED ([WILDCARD]ms) +./test/parallel_output.ts => step nested failure ... FAILED ([WILDCARD]ms) + + ERRORS + +step failures => ./test/parallel_output.ts:12:6 +error: Error: 2 test steps failed. + at [WILDCARD] + +step nested failure => ./test/parallel_output.ts:20:6 +error: Error: 1 test step failed. + at [WILDCARD] + + FAILURES + +step failures => ./test/parallel_output.ts:12:6 +step nested failure => ./test/parallel_output.ts:20:6 + +FAILED | 1 passed (6 steps) | 2 failed (4 steps) ([WILDCARD]ms) + +error: Test failed diff --git a/cli/tests/testdata/test/parallel_output.ts b/cli/tests/testdata/test/parallel_output.ts new file mode 100644 index 000000000..5de733aad --- /dev/null +++ b/cli/tests/testdata/test/parallel_output.ts @@ -0,0 +1,27 @@ +Deno.test("step output", async (t) => { + await t.step("step 1", () => {}); + await t.step("step 2", () => {}); + await t.step("step 3", () => { + console.log("Hello, world! (from step 3)"); + }); + await t.step("step 4", () => { + console.log("Hello, world! (from step 4)"); + }); +}); + +Deno.test("step failures", async (t) => { + await t.step("step 1", () => {}); + await t.step("step 2", () => { + throw new Error("Fail."); + }); + await t.step("step 3", () => Promise.reject(new Error("Fail."))); +}); + +Deno.test("step nested failure", async (t) => { + await t.step("step 1", async (t) => { + await t.step("inner 1", () => {}); + await t.step("inner 2", () => { + throw new Error("Failed."); + }); + }); +}); diff --git a/cli/tests/testdata/test/short-pass-jobs-flag-warning.out b/cli/tests/testdata/test/short-pass-jobs-flag-warning.out index b70ec5ee1..8a2f7fe5d 100644 --- a/cli/tests/testdata/test/short-pass-jobs-flag-warning.out +++ b/cli/tests/testdata/test/short-pass-jobs-flag-warning.out @@ -1,7 +1,6 @@ Warning: --jobs flag is deprecated. Use the --parallel flag with possibly the 'DENO_JOBS' environment variable. Check [WILDCARD]/test/short-pass.ts -running 1 test from ./test/short-pass.ts -test ... ok ([WILDCARD]) +./test/short-pass.ts => test ... ok ([WILDCARD]) ok | 1 passed | 0 failed ([WILDCARD]) diff --git a/cli/tests/testdata/test/short-pass.out b/cli/tests/testdata/test/short-pass.out index 09b72d5fd..3f239de41 100644 --- a/cli/tests/testdata/test/short-pass.out +++ b/cli/tests/testdata/test/short-pass.out @@ -1,6 +1,5 @@ Check [WILDCARD]/test/short-pass.ts -running 1 test from ./test/short-pass.ts -test ... ok ([WILDCARD]) +./test/short-pass.ts => test ... ok ([WILDCARD]) ok | 1 passed | 0 failed ([WILDCARD]) diff --git a/cli/tests/testdata/test/steps/output_within.out b/cli/tests/testdata/test/steps/output_within.out index 0f5c95ce3..34d94b6f8 100644 --- a/cli/tests/testdata/test/steps/output_within.out +++ b/cli/tests/testdata/test/steps/output_within.out @@ -18,12 +18,10 @@ description ... 4 ----- output end ----- inner 2 ... ok ([WILDCARD]ms) - ------- output ------- 5 ----- output end ----- step 1 ... ok ([WILDCARD]ms) - ------- output ------- 6 ----- output end ----- |