fix(test): disable preventDefault() for beforeunload event (#18911)

Fixes #18910.
This commit is contained in:
Nayeem Rahman 2023-05-03 22:10:51 +01:00 committed by GitHub
parent d905f20cad
commit e3276fbb71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 12 deletions

View file

@ -0,0 +1,7 @@
cpu: [WILDCARD]
runtime: deno [WILDCARD]
[WILDCARD]/before_unload_prevent_default.ts
benchmark time (avg) (min … max) p75 p99 p995
------------------------------------------------- -----------------------------
foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -0,0 +1,6 @@
addEventListener("beforeunload", (e) => {
// The worker should be killed once benchmarks are done regardless of this.
e.preventDefault();
});
Deno.bench("foo", () => {});

View file

@ -0,0 +1,5 @@
running 1 test from [WILDCARD]/before_unload_prevent_default.ts
foo ... ok ([WILDCARD])
ok | 1 passed | 0 failed ([WILDCARD])

View file

@ -0,0 +1,6 @@
addEventListener("beforeunload", (e) => {
// The worker should be killed once tests are done regardless of this.
e.preventDefault();
});
Deno.test("foo", () => {});