From 029bdf0cd55e96f393614ca566d57e4330ac9135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 2 Aug 2023 18:38:10 +0200 Subject: feat(cli): Add dot test reporter (#19804) This commit adds a "dot" reporter to "deno test" subcommand, that can be activated using "--dot" flag. It provides a concise output using: - "." for passing test - "," for ignored test - "!" for failing test User output is silenced and not printed to the console. In non-TTY environments each result is printed on a separate line. --- .../testdata/test/steps/failing_steps.dot.out | 54 ++++++++++++++++++++++ .../testdata/test/steps/ignored_steps.dot.out | 6 +++ .../testdata/test/steps/passing_steps.dot.out | 17 +++++++ 3 files changed, 77 insertions(+) create mode 100644 cli/tests/testdata/test/steps/failing_steps.dot.out create mode 100644 cli/tests/testdata/test/steps/ignored_steps.dot.out create mode 100644 cli/tests/testdata/test/steps/passing_steps.dot.out (limited to 'cli/tests/testdata/test/steps') diff --git a/cli/tests/testdata/test/steps/failing_steps.dot.out b/cli/tests/testdata/test/steps/failing_steps.dot.out new file mode 100644 index 000000000..3895a967e --- /dev/null +++ b/cli/tests/testdata/test/steps/failing_steps.dot.out @@ -0,0 +1,54 @@ +[WILDCARD] +! +. +! +! +! +! +! +! +! + + ERRORS + +nested failure ... step 1 ... inner 1 => ./test/steps/failing_steps.ts:[WILDCARD] +error: Error: Failed. + throw new Error("Failed."); + ^ + at [WILDCARD]/failing_steps.ts:[WILDCARD] + +multiple test step failures ... step 1 => ./test/steps/failing_steps.ts:[WILDCARD] +error: Error: Fail. + throw new Error("Fail."); + ^ + at [WILDCARD]/failing_steps.ts:[WILDCARD] + +multiple test step failures ... step 2 => ./test/steps/failing_steps.ts:[WILDCARD] +error: Error: Fail. + await t.step("step 2", () => Promise.reject(new Error("Fail."))); + ^ + at [WILDCARD]/failing_steps.ts:[WILDCARD] + +failing step in failing test ... step 1 => ./test/steps/failing_steps.ts:[WILDCARD] +error: Error: Fail. + throw new Error("Fail."); + ^ + at [WILDCARD]/failing_steps.ts:[WILDCARD] + +failing step in failing test => ./test/steps/failing_steps.ts:[WILDCARD] +error: Error: Fail test. + throw new Error("Fail test."); + ^ + at [WILDCARD]/failing_steps.ts:[WILDCARD] + + FAILURES + +nested failure ... step 1 ... inner 1 => ./test/steps/failing_steps.ts:[WILDCARD] +multiple test step failures ... step 1 => ./test/steps/failing_steps.ts:[WILDCARD] +multiple test step failures ... step 2 => ./test/steps/failing_steps.ts:[WILDCARD] +failing step in failing test ... step 1 => ./test/steps/failing_steps.ts:[WILDCARD] +failing step in failing test => ./test/steps/failing_steps.ts:[WILDCARD] + +FAILED | 0 passed (1 step) | 3 failed (5 steps) ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/steps/ignored_steps.dot.out b/cli/tests/testdata/test/steps/ignored_steps.dot.out new file mode 100644 index 000000000..e3d3865d4 --- /dev/null +++ b/cli/tests/testdata/test/steps/ignored_steps.dot.out @@ -0,0 +1,6 @@ +[WILDCARD] +, +. +. + +ok | 1 passed (1 step) | 0 failed | 0 ignored (1 step) [WILDCARD] diff --git a/cli/tests/testdata/test/steps/passing_steps.dot.out b/cli/tests/testdata/test/steps/passing_steps.dot.out new file mode 100644 index 000000000..243cacd69 --- /dev/null +++ b/cli/tests/testdata/test/steps/passing_steps.dot.out @@ -0,0 +1,17 @@ +[WILDCARD] +. +. +. +. +. +. +. +. +. +. +. +. +. + +ok | 6 passed (21 steps) | 0 failed ([WILDCARD]) + -- cgit v1.2.3