summaryrefslogtreecommitdiff
path: root/tests/specs/test/steps_failing_steps
diff options
context:
space:
mode:
authorHasanAlrimawi <141642411+HasanAlrimawi@users.noreply.github.com>2024-09-16 22:38:40 +0300
committerGitHub <noreply@github.com>2024-09-16 19:38:40 +0000
commite0b9c745c15720914f14996bf357d5b375e2dbd8 (patch)
tree0dfc717082bedb2eec13eceb5cdeb1ef12b8f7f5 /tests/specs/test/steps_failing_steps
parent6ce16145dd12d8a272cb543871276c33c8201a37 (diff)
chore: deprecate test itests (#25512)
This PR is part of #22907 --------- Signed-off-by: HasanAlrimawi <141642411+HasanAlrimawi@users.noreply.github.com> Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'tests/specs/test/steps_failing_steps')
-rw-r--r--tests/specs/test/steps_failing_steps/__test__.jsonc5
-rw-r--r--tests/specs/test/steps_failing_steps/failing_steps.out59
-rw-r--r--tests/specs/test/steps_failing_steps/failing_steps.ts27
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.");
+});