summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/test/steps/failing_steps.ts
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2021-10-11 09:45:02 -0400
committerGitHub <noreply@github.com>2021-10-11 09:45:02 -0400
commit426ebf854a82c63cdaa2413fbd1b005025dba95b (patch)
tree316a426e280db29745444e7606952c8c235c846a /cli/tests/testdata/test/steps/failing_steps.ts
parent668b400ff2fa5634f575e54f40ab1f0b78fcdf16 (diff)
feat(unstable/test): imperative test steps API (#12190)
Diffstat (limited to 'cli/tests/testdata/test/steps/failing_steps.ts')
-rw-r--r--cli/tests/testdata/test/steps/failing_steps.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/cli/tests/testdata/test/steps/failing_steps.ts b/cli/tests/testdata/test/steps/failing_steps.ts
new file mode 100644
index 000000000..efa18d54e
--- /dev/null
+++ b/cli/tests/testdata/test/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.");
+});