summaryrefslogtreecommitdiff
path: root/tests/specs/test/steps_tap_failing_steps/failing_steps.ts
blob: efa18d54ef80cfcddbf89cccc56c022abf6e4d39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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.");
});