diff options
| author | Leo Kettmeir <crowlkats@toaxl.com> | 2023-01-24 15:41:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-24 15:41:01 +0100 |
| commit | 2027d98a8e9e530277ab301841872cdea7e2d590 (patch) | |
| tree | 04d541e094c28d039b7d88cf699cb01e24bf07bd /cli/tests | |
| parent | fc2e00152b162280e78b06028d51274e33275629 (diff) | |
feat: allow first arg in test step to be a function (#17096)
Diffstat (limited to 'cli/tests')
| -rw-r--r-- | cli/tests/testdata/test/steps/passing_steps.out | 10 | ||||
| -rw-r--r-- | cli/tests/testdata/test/steps/passing_steps.ts | 9 | ||||
| -rw-r--r-- | cli/tests/unit/testing_test.ts | 2 |
3 files changed, 18 insertions, 3 deletions
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([ diff --git a/cli/tests/unit/testing_test.ts b/cli/tests/unit/testing_test.ts index 9c906a111..4e28d545c 100644 --- a/cli/tests/unit/testing_test.ts +++ b/cli/tests/unit/testing_test.ts @@ -114,7 +114,7 @@ Deno.test(async function invalidStepArguments(t) { await (t as any).step(() => {}); }, TypeError, - "Expected a test definition or name and function.", + "The step function must have a name.", ); }); |
