mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
e0b9c745c1
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>
27 lines
775 B
TypeScript
27 lines
775 B
TypeScript
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.");
|
|
});
|