diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/test_runner.rs | 9 | ||||
-rw-r--r-- | cli/tests/deno_test_unresolved_promise.out | 4 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/test_unresolved_promise.js | 15 |
4 files changed, 30 insertions, 4 deletions
diff --git a/cli/test_runner.rs b/cli/test_runner.rs index 1e91d1c30..fa0da706b 100644 --- a/cli/test_runner.rs +++ b/cli/test_runner.rs @@ -82,11 +82,12 @@ pub fn render_test_file( json!({ "failFast": fail_fast, "reportToConsole": !quiet, "disableLog": quiet }) }; - let run_tests_cmd = format!( - "// @ts-ignore\nDeno[Deno.internal].runTests({});\n", + test_file.push_str("// @ts-ignore\n"); + + test_file.push_str(&format!( + "await Deno[Deno.internal].runTests({});\n", options - ); - test_file.push_str(&run_tests_cmd); + )); test_file } diff --git a/cli/tests/deno_test_unresolved_promise.out b/cli/tests/deno_test_unresolved_promise.out new file mode 100644 index 000000000..cc4f2985e --- /dev/null +++ b/cli/tests/deno_test_unresolved_promise.out @@ -0,0 +1,4 @@ +Check [WILDCARD] +running 2 tests +test unresolved promise ... in promise +error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promise. diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 66a83a655..9dff74f25 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1646,6 +1646,12 @@ itest!(deno_test_no_check { output: "deno_test.out", }); +itest!(deno_test_unresolved_promise { + args: "test test_unresolved_promise.js", + exit_code: 1, + output: "deno_test_unresolved_promise.out", +}); + #[test] fn timeout_clear() { // https://github.com/denoland/deno/issues/7599 diff --git a/cli/tests/test_unresolved_promise.js b/cli/tests/test_unresolved_promise.js new file mode 100644 index 000000000..466b18864 --- /dev/null +++ b/cli/tests/test_unresolved_promise.js @@ -0,0 +1,15 @@ +Deno.test({ + name: "unresolved promise", + fn() { + return new Promise((_resolve, _reject) => { + console.log("in promise"); + }); + }, +}); + +Deno.test({ + name: "ok", + fn() { + console.log("ok test"); + }, +}); |