From 2027d98a8e9e530277ab301841872cdea7e2d590 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Tue, 24 Jan 2023 15:41:01 +0100 Subject: feat: allow first arg in test step to be a function (#17096) --- cli/tests/testdata/test/steps/passing_steps.out | 10 ++++++++-- cli/tests/testdata/test/steps/passing_steps.ts | 9 +++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'cli/tests/testdata/test') diff --git a/cli/tests/testdata/test/steps/passing_steps.out b/cli/tests/testdata/test/steps/passing_steps.out index 5eacc571c..231a9a170 100644 --- a/cli/tests/testdata/test/steps/passing_steps.out +++ b/cli/tests/testdata/test/steps/passing_steps.out @@ -1,11 +1,17 @@ [WILDCARD] -running 5 tests from ./test/steps/passing_steps.ts +running 6 tests from ./test/steps/passing_steps.ts description ... step 1 ... inner 1 ... ok ([WILDCARD]ms) inner 2 ... ok ([WILDCARD]ms) step 1 ... ok ([WILDCARD]ms) description ... ok ([WILDCARD]ms) +description function as first arg ... + step1 ... + inner1 ... ok ([WILDCARD]ms) + inner1 ... ok ([WILDCARD]ms) + step1 ... ok ([WILDCARD]ms) +description function as first arg ... ok ([WILDCARD]ms) parallel steps without sanitizers ... step 1 ... ok ([WILDCARD]) step 2 ... ok ([WILDCARD]) @@ -35,4 +41,4 @@ steps buffered then streaming reporting ... step 2 ... ok ([WILDCARD]) steps buffered then streaming reporting ... ok ([WILDCARD]) -ok | 5 passed (18 steps) | 0 failed [WILDCARD] +ok | 6 passed (21 steps) | 0 failed [WILDCARD] diff --git a/cli/tests/testdata/test/steps/passing_steps.ts b/cli/tests/testdata/test/steps/passing_steps.ts index fbd52e2d3..38de116a7 100644 --- a/cli/tests/testdata/test/steps/passing_steps.ts +++ b/cli/tests/testdata/test/steps/passing_steps.ts @@ -9,6 +9,15 @@ Deno.test("description", async (t) => { if (!success) throw new Error("Expected the step to return true."); }); +Deno.test("description function as first arg", async (t) => { + const success = await t.step(async function step1(t) { + await t.step(function inner1() {}); + await t.step(function inner1() {}); + }); + + if (!success) throw new Error("Expected the step to return true."); +}); + Deno.test("parallel steps without sanitizers", async (t) => { // allowed await Promise.all([ -- cgit v1.2.3