From d8afd5683857de83f3cc80c33322df3d65377210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 23 Nov 2021 14:57:51 +0100 Subject: feat(test): Add more overloads for "Deno.test" (#12749) This commit adds 4 more overloads to "Deno.test()" API. ``` // Deno.test(function testName() { }); export function test(fn: (t: TestContext) => void | Promise): void; // Deno.test("test name", { only: true }, function() { }); export function test( name: string, options: Omit, fn: (t: TestContext) => void | Promise, ): void; // Deno.test({ name: "test name" }, function() { }); export function test( options: Omit, fn: (t: TestContext) => void | Promise, ): void; // Deno.test({ only: true }, function testName() { }); export function test( options: Omit, fn: (t: TestContext) => void | Promise, ): void; ``` --- cli/tests/testdata/test/overloads.out | 11 +++++++++++ cli/tests/testdata/test/overloads.ts | 6 ++++++ 2 files changed, 17 insertions(+) create mode 100644 cli/tests/testdata/test/overloads.out create mode 100644 cli/tests/testdata/test/overloads.ts (limited to 'cli/tests/testdata/test') diff --git a/cli/tests/testdata/test/overloads.out b/cli/tests/testdata/test/overloads.out new file mode 100644 index 000000000..13c088f6c --- /dev/null +++ b/cli/tests/testdata/test/overloads.out @@ -0,0 +1,11 @@ +Check [WILDCARD]/test/overloads.ts +running 6 tests from [WILDCARD]/test/overloads.ts +test test0 ... ok ([WILDCARD]) +test test1 ... ok ([WILDCARD]) +test test2 ... ok ([WILDCARD]) +test test3 ... ok ([WILDCARD]) +test test4 ... ok ([WILDCARD]) +test test5 ... ignored ([WILDCARD]) + +test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/overloads.ts b/cli/tests/testdata/test/overloads.ts new file mode 100644 index 000000000..eb7b3dccc --- /dev/null +++ b/cli/tests/testdata/test/overloads.ts @@ -0,0 +1,6 @@ +Deno.test("test0", () => {}); +Deno.test(function test1() {}); +Deno.test({ name: "test2", fn: () => {} }); +Deno.test("test3", { permissions: "none" }, () => {}); +Deno.test({ name: "test4" }, () => {}); +Deno.test({ ignore: true }, function test5() {}); -- cgit v1.2.3