summaryrefslogtreecommitdiff
path: root/cli/tools
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools')
-rw-r--r--cli/tools/test_runner.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/cli/tools/test_runner.rs b/cli/tools/test_runner.rs
index 304c61b11..4018e0a14 100644
--- a/cli/tools/test_runner.rs
+++ b/cli/tools/test_runner.rs
@@ -16,7 +16,6 @@ use deno_core::futures::future;
use deno_core::futures::stream;
use deno_core::futures::FutureExt;
use deno_core::futures::StreamExt;
-use deno_core::located_script_name;
use deno_core::serde_json::json;
use deno_core::ModuleSpecifier;
use deno_runtime::permissions::Permissions;
@@ -221,6 +220,8 @@ pub async fn test_specifier(
test_source
.push_str("await new Promise(resolve => setTimeout(resolve, 0));\n");
+ test_source.push_str("window.dispatchEvent(new Event('load'));\n");
+
test_source.push_str(&format!(
"await Deno[Deno.internal].runTests({});\n",
json!({
@@ -230,6 +231,8 @@ pub async fn test_specifier(
}),
));
+ test_source.push_str("window.dispatchEvent(new Event('unload'));\n");
+
let test_file = File {
local: test_module.to_file_path().unwrap(),
maybe_types: None,
@@ -266,20 +269,11 @@ pub async fn test_specifier(
None
};
- worker.execute_script(
- &located_script_name!(),
- "window.dispatchEvent(new Event('load'))",
- )?;
-
worker.execute_module(&test_module).await?;
worker
.run_event_loop(maybe_coverage_collector.is_none())
.await?;
- worker.execute_script(
- &located_script_name!(),
- "window.dispatchEvent(new Event('unload'))",
- )?;
if let Some(coverage_collector) = maybe_coverage_collector.as_mut() {
worker