diff options
Diffstat (limited to 'tests/specs/test/steps_failing_steps')
| -rw-r--r-- | tests/specs/test/steps_failing_steps/__test__.jsonc | 5 | ||||
| -rw-r--r-- | tests/specs/test/steps_failing_steps/failing_steps.out | 59 | ||||
| -rw-r--r-- | tests/specs/test/steps_failing_steps/failing_steps.ts | 27 |
3 files changed, 91 insertions, 0 deletions
diff --git a/tests/specs/test/steps_failing_steps/__test__.jsonc b/tests/specs/test/steps_failing_steps/__test__.jsonc new file mode 100644 index 000000000..f4194c50c --- /dev/null +++ b/tests/specs/test/steps_failing_steps/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "test failing_steps.ts", + "exitCode": 1, + "output": "failing_steps.out" +} diff --git a/tests/specs/test/steps_failing_steps/failing_steps.out b/tests/specs/test/steps_failing_steps/failing_steps.out new file mode 100644 index 000000000..f66e089bc --- /dev/null +++ b/tests/specs/test/steps_failing_steps/failing_steps.out @@ -0,0 +1,59 @@ +[WILDCARD] +running 3 tests from [WILDCARD]failing_steps.ts +nested failure ... + step 1 ... + inner 1 ... FAILED ([WILDCARD]) + inner 2 ... ok ([WILDCARD]) + step 1 ... FAILED (due to 1 failed step) ([WILDCARD]) +nested failure ... FAILED (due to 1 failed step) ([WILDCARD]) +multiple test step failures ... + step 1 ... FAILED ([WILDCARD]) + step 2 ... FAILED ([WILDCARD]) +multiple test step failures ... FAILED (due to 2 failed steps) ([WILDCARD]) +failing step in failing test ... + step 1 ... FAILED ([WILDCARD]) +failing step in failing test ... FAILED ([WILDCARD]) + + ERRORS + +nested failure ... step 1 ... inner 1 => [WILDCARD]failing_steps.ts:[WILDCARD] +error: Error: Failed. + throw new Error("Failed."); + ^ + at [WILDCARD]/failing_steps.ts:[WILDCARD] + +multiple test step failures ... step 1 => [WILDCARD]failing_steps.ts:[WILDCARD] +error: Error: Fail. + throw new Error("Fail."); + ^ + at [WILDCARD]/failing_steps.ts:[WILDCARD] + +multiple test step failures ... step 2 => [WILDCARD]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 => [WILDCARD]failing_steps.ts:[WILDCARD] +error: Error: Fail. + throw new Error("Fail."); + ^ + at [WILDCARD]/failing_steps.ts:[WILDCARD] + +failing step in failing test => [WILDCARD]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 => [WILDCARD]failing_steps.ts:[WILDCARD] +multiple test step failures ... step 1 => [WILDCARD]failing_steps.ts:[WILDCARD] +multiple test step failures ... step 2 => [WILDCARD]failing_steps.ts:[WILDCARD] +failing step in failing test ... step 1 => [WILDCARD]failing_steps.ts:[WILDCARD] +failing step in failing test => [WILDCARD]failing_steps.ts:[WILDCARD] + +FAILED | 0 passed (1 step) | 3 failed (5 steps) ([WILDCARD]) + +error: Test failed diff --git a/tests/specs/test/steps_failing_steps/failing_steps.ts b/tests/specs/test/steps_failing_steps/failing_steps.ts new file mode 100644 index 000000000..efa18d54e --- /dev/null +++ b/tests/specs/test/steps_failing_steps/failing_steps.ts @@ -0,0 +1,27 @@ +Deno.test("nested failure", async (t) => { + const success = await t.step("step 1", async (t) => { + let success = await t.step("inner 1", () => { + throw new Error("Failed."); + }); + if (success) throw new Error("Expected failure"); + + success = await t.step("inner 2", () => {}); + if (!success) throw new Error("Expected success"); + }); + + if (success) throw new Error("Expected failure"); +}); + +Deno.test("multiple test step failures", async (t) => { + await t.step("step 1", () => { + throw new Error("Fail."); + }); + await t.step("step 2", () => Promise.reject(new Error("Fail."))); +}); + +Deno.test("failing step in failing test", async (t) => { + await t.step("step 1", () => { + throw new Error("Fail."); + }); + throw new Error("Fail test."); +}); |
