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/integration/mod.rs | 20 ++++++++++---------- cli/tests/integration/test_tests.rs | 6 ++++++ 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'cli/tests/integration') diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs index 21ffc5627..cfb950901 100644 --- a/cli/tests/integration/mod.rs +++ b/cli/tests/integration/mod.rs @@ -1016,29 +1016,29 @@ async fn test_resolve_dns() { #[test] fn typecheck_declarations_ns() { - let status = util::deno_cmd() + let output = util::deno_cmd() .arg("test") .arg("--doc") .arg(util::root_path().join("cli/dts/lib.deno.ns.d.ts")) - .spawn() - .unwrap() - .wait() + .output() .unwrap(); - assert!(status.success()); + println!("stdout: {}", String::from_utf8(output.stdout).unwrap()); + println!("stderr: {}", String::from_utf8(output.stderr).unwrap()); + assert!(output.status.success()); } #[test] fn typecheck_declarations_unstable() { - let status = util::deno_cmd() + let output = util::deno_cmd() .arg("test") .arg("--doc") .arg("--unstable") .arg(util::root_path().join("cli/dts/lib.deno.unstable.d.ts")) - .spawn() - .unwrap() - .wait() + .output() .unwrap(); - assert!(status.success()); + println!("stdout: {}", String::from_utf8(output.stdout).unwrap()); + println!("stderr: {}", String::from_utf8(output.stderr).unwrap()); + assert!(output.status.success()); } #[test] diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index e5d3fd358..3f23efca2 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -19,6 +19,12 @@ fn no_color() { assert!(out.contains("test result: FAILED. 1 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out")); } +itest!(overloads { + args: "test test/overloads.ts", + exit_code: 0, + output: "test/overloads.out", +}); + itest!(meta { args: "test test/meta.ts", exit_code: 0, -- cgit v1.2.3