summaryrefslogtreecommitdiff
path: root/tests/testdata/bench
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testdata/bench')
-rw-r--r--tests/testdata/bench/allow_all.out21
-rw-r--r--tests/testdata/bench/allow_all.ts43
-rw-r--r--tests/testdata/bench/allow_none.out22
-rw-r--r--tests/testdata/bench/allow_none.ts23
-rw-r--r--tests/testdata/bench/before_unload_prevent_default.out7
-rw-r--r--tests/testdata/bench/before_unload_prevent_default.ts6
-rw-r--r--tests/testdata/bench/bench_formatting.out8
-rw-r--r--tests/testdata/bench/bench_formatting.ts3
-rw-r--r--tests/testdata/bench/check_local_by_default.out6
-rw-r--r--tests/testdata/bench/check_local_by_default.ts3
-rw-r--r--tests/testdata/bench/check_local_by_default2.out4
-rw-r--r--tests/testdata/bench/check_local_by_default2.ts6
-rw-r--r--tests/testdata/bench/clear_timeout.out10
-rw-r--r--tests/testdata/bench/clear_timeout.ts5
-rw-r--r--tests/testdata/bench/collect.out18
-rw-r--r--tests/testdata/bench/collect/bench.ts0
-rw-r--r--tests/testdata/bench/collect/deno.jsonc5
-rw-r--r--tests/testdata/bench/collect/deno.malformed.jsonc5
-rw-r--r--tests/testdata/bench/collect/deno2.jsonc6
-rw-r--r--tests/testdata/bench/collect/ignore/bench.ts1
-rw-r--r--tests/testdata/bench/collect/include/2_bench.ts0
-rw-r--r--tests/testdata/bench/collect/include/bench.ts0
-rw-r--r--tests/testdata/bench/collect2.out13
-rw-r--r--tests/testdata/bench/collect_with_malformed_config.out4
-rw-r--r--tests/testdata/bench/exit_sanitizer.out14
-rw-r--r--tests/testdata/bench/exit_sanitizer.ts11
-rw-r--r--tests/testdata/bench/explicit_start_and_end.out25
-rw-r--r--tests/testdata/bench/explicit_start_and_end.ts50
-rw-r--r--tests/testdata/bench/explicit_start_and_end_low_precision.out10
-rw-r--r--tests/testdata/bench/explicit_start_and_end_low_precision.ts4
-rw-r--r--tests/testdata/bench/fail.out28
-rw-r--r--tests/testdata/bench/fail.ts30
-rw-r--r--tests/testdata/bench/file_protocol.out8
-rw-r--r--tests/testdata/bench/file_protocol.ts1
-rw-r--r--tests/testdata/bench/filter.out20
-rw-r--r--tests/testdata/bench/filter/a_bench.ts3
-rw-r--r--tests/testdata/bench/filter/b_bench.ts3
-rw-r--r--tests/testdata/bench/filter/c_bench.ts3
-rw-r--r--tests/testdata/bench/finally_timeout.out11
-rw-r--r--tests/testdata/bench/finally_timeout.ts11
-rw-r--r--tests/testdata/bench/group_baseline.out20
-rw-r--r--tests/testdata/bench/group_baseline.ts15
-rw-r--r--tests/testdata/bench/ignore.out8
-rw-r--r--tests/testdata/bench/ignore.ts9
-rw-r--r--tests/testdata/bench/ignore_permissions.out8
-rw-r--r--tests/testdata/bench/ignore_permissions.ts16
-rw-r--r--tests/testdata/bench/interval.out8
-rw-r--r--tests/testdata/bench/interval.ts1
-rw-r--r--tests/testdata/bench/load_unload.out8
-rw-r--r--tests/testdata/bench/load_unload.ts22
-rw-r--r--tests/testdata/bench/meta.out10
-rw-r--r--tests/testdata/bench/meta.ts2
-rw-r--r--tests/testdata/bench/multifile_summary.out64
-rw-r--r--tests/testdata/bench/multiple_group.ts15
-rw-r--r--tests/testdata/bench/no_check.out9
-rw-r--r--tests/testdata/bench/no_check.ts1
-rw-r--r--tests/testdata/bench/no_color.ts17
-rw-r--r--tests/testdata/bench/no_prompt_by_default.out9
-rw-r--r--tests/testdata/bench/no_prompt_by_default.ts3
-rw-r--r--tests/testdata/bench/no_prompt_with_denied_perms.out9
-rw-r--r--tests/testdata/bench/no_prompt_with_denied_perms.ts3
-rw-r--r--tests/testdata/bench/no_run.out5
-rw-r--r--tests/testdata/bench/no_run.ts2
-rw-r--r--tests/testdata/bench/only.out9
-rw-r--r--tests/testdata/bench/only.ts15
-rw-r--r--tests/testdata/bench/overloads.out12
-rw-r--r--tests/testdata/bench/overloads.ts6
-rw-r--r--tests/testdata/bench/pass.json.out28
-rw-r--r--tests/testdata/bench/pass.out17
-rw-r--r--tests/testdata/bench/pass.ts10
-rw-r--r--tests/testdata/bench/quiet.out10
-rw-r--r--tests/testdata/bench/quiet.ts15
-rw-r--r--tests/testdata/bench/recursive_permissions_pledge.js6
-rw-r--r--tests/testdata/bench/unhandled_rejection.out11
-rw-r--r--tests/testdata/bench/unhandled_rejection.ts3
-rw-r--r--tests/testdata/bench/unresolved_promise.out9
-rw-r--r--tests/testdata/bench/unresolved_promise.ts1
77 files changed, 867 insertions, 0 deletions
diff --git a/tests/testdata/bench/allow_all.out b/tests/testdata/bench/allow_all.out
new file mode 100644
index 000000000..b118856e9
--- /dev/null
+++ b/tests/testdata/bench/allow_all.out
@@ -0,0 +1,21 @@
+Check [WILDCARD]/bench/allow_all.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/allow_all.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+------------------------------------------------------------------ -----------------------------
+read false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+read true [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+write false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+write true [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+net false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+net true [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+env false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+env true [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+run false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+run true [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+ffi false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+ffi true [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+hrtime false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+hrtime true [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/allow_all.ts b/tests/testdata/bench/allow_all.ts
new file mode 100644
index 000000000..43e005b58
--- /dev/null
+++ b/tests/testdata/bench/allow_all.ts
@@ -0,0 +1,43 @@
+import { assertEquals } from "../../../test_util/std/assert/mod.ts";
+
+const permissions: Deno.PermissionName[] = [
+ "read",
+ "write",
+ "net",
+ "env",
+ "run",
+ "ffi",
+ "hrtime",
+];
+
+for (const name of permissions) {
+ Deno.bench({
+ name: `${name} false`,
+ permissions: {
+ [name]: false,
+ },
+ async fn() {
+ for await (const n of permissions) {
+ const status = await Deno.permissions.query({ name: n });
+ assertEquals(status.state, "prompt");
+ }
+ },
+ });
+
+ Deno.bench({
+ name: `${name} true`,
+ permissions: {
+ [name]: true,
+ },
+ async fn() {
+ for await (const n of permissions) {
+ const status = await Deno.permissions.query({ name: n });
+ if (n === name) {
+ assertEquals(status.state, "granted");
+ } else {
+ assertEquals(status.state, "prompt");
+ }
+ }
+ },
+ });
+}
diff --git a/tests/testdata/bench/allow_none.out b/tests/testdata/bench/allow_none.out
new file mode 100644
index 000000000..7c443075b
--- /dev/null
+++ b/tests/testdata/bench/allow_none.out
@@ -0,0 +1,22 @@
+Check [WILDCARD]/bench/allow_none.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/allow_none.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+read error: PermissionDenied: Can't escalate parent thread permissions
+[WILDCARD]
+write error: PermissionDenied: Can't escalate parent thread permissions
+[WILDCARD]
+net error: PermissionDenied: Can't escalate parent thread permissions
+[WILDCARD]
+env error: PermissionDenied: Can't escalate parent thread permissions
+[WILDCARD]
+run error: PermissionDenied: Can't escalate parent thread permissions
+[WILDCARD]
+ffi error: PermissionDenied: Can't escalate parent thread permissions
+[WILDCARD]
+hrtime error: PermissionDenied: Can't escalate parent thread permissions
+[WILDCARD]
+error: Bench failed
diff --git a/tests/testdata/bench/allow_none.ts b/tests/testdata/bench/allow_none.ts
new file mode 100644
index 000000000..62eb9c4c6
--- /dev/null
+++ b/tests/testdata/bench/allow_none.ts
@@ -0,0 +1,23 @@
+import { unreachable } from "../../../test_util/std/assert/mod.ts";
+
+const permissions: Deno.PermissionName[] = [
+ "read",
+ "write",
+ "net",
+ "env",
+ "run",
+ "ffi",
+ "hrtime",
+];
+
+for (const name of permissions) {
+ Deno.bench({
+ name,
+ permissions: {
+ [name]: true,
+ },
+ fn() {
+ unreachable();
+ },
+ });
+}
diff --git a/tests/testdata/bench/before_unload_prevent_default.out b/tests/testdata/bench/before_unload_prevent_default.out
new file mode 100644
index 000000000..dcb6d8194
--- /dev/null
+++ b/tests/testdata/bench/before_unload_prevent_default.out
@@ -0,0 +1,7 @@
+cpu: [WILDCARD]
+runtime: deno [WILDCARD]
+
+[WILDCARD]/before_unload_prevent_default.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/before_unload_prevent_default.ts b/tests/testdata/bench/before_unload_prevent_default.ts
new file mode 100644
index 000000000..2759d4659
--- /dev/null
+++ b/tests/testdata/bench/before_unload_prevent_default.ts
@@ -0,0 +1,6 @@
+addEventListener("beforeunload", (e) => {
+ // The worker should be killed once benchmarks are done regardless of this.
+ e.preventDefault();
+});
+
+Deno.bench("foo", () => {});
diff --git a/tests/testdata/bench/bench_formatting.out b/tests/testdata/bench/bench_formatting.out
new file mode 100644
index 000000000..5e3eed1cd
--- /dev/null
+++ b/tests/testdata/bench/bench_formatting.out
@@ -0,0 +1,8 @@
+Check [WILDCARD]/bench/bench_formatting.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/bench_formatting.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+[WILDCARD] [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] \ No newline at end of file
diff --git a/tests/testdata/bench/bench_formatting.ts b/tests/testdata/bench/bench_formatting.ts
new file mode 100644
index 000000000..fdee15abb
--- /dev/null
+++ b/tests/testdata/bench/bench_formatting.ts
@@ -0,0 +1,3 @@
+Deno.bench("Date.now", () => {
+ Date.now();
+});
diff --git a/tests/testdata/bench/check_local_by_default.out b/tests/testdata/bench/check_local_by_default.out
new file mode 100644
index 000000000..bf07bcc44
--- /dev/null
+++ b/tests/testdata/bench/check_local_by_default.out
@@ -0,0 +1,6 @@
+[WILDCARD]
+
+[WILDCARD]/bench/check_local_by_default.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
diff --git a/tests/testdata/bench/check_local_by_default.ts b/tests/testdata/bench/check_local_by_default.ts
new file mode 100644
index 000000000..2ae8c2692
--- /dev/null
+++ b/tests/testdata/bench/check_local_by_default.ts
@@ -0,0 +1,3 @@
+import * as a from "http://localhost:4545/subdir/type_error.ts";
+
+console.log(a.a);
diff --git a/tests/testdata/bench/check_local_by_default2.out b/tests/testdata/bench/check_local_by_default2.out
new file mode 100644
index 000000000..01aeda636
--- /dev/null
+++ b/tests/testdata/bench/check_local_by_default2.out
@@ -0,0 +1,4 @@
+error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'.
+const b: "b" = 12;
+ ^
+ at [WILDCARD]bench/check_local_by_default2.ts:3:7
diff --git a/tests/testdata/bench/check_local_by_default2.ts b/tests/testdata/bench/check_local_by_default2.ts
new file mode 100644
index 000000000..5177ff944
--- /dev/null
+++ b/tests/testdata/bench/check_local_by_default2.ts
@@ -0,0 +1,6 @@
+import * as a from "http://localhost:4545/subdir/type_error.ts";
+
+const b: "b" = 12;
+
+console.log(a.a);
+console.log(b);
diff --git a/tests/testdata/bench/clear_timeout.out b/tests/testdata/bench/clear_timeout.out
new file mode 100644
index 000000000..fe17b4ae3
--- /dev/null
+++ b/tests/testdata/bench/clear_timeout.out
@@ -0,0 +1,10 @@
+Check [WILDCARD]/bench/clear_timeout.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/clear_timeout.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/clear_timeout.ts b/tests/testdata/bench/clear_timeout.ts
new file mode 100644
index 000000000..4148263ac
--- /dev/null
+++ b/tests/testdata/bench/clear_timeout.ts
@@ -0,0 +1,5 @@
+clearTimeout(setTimeout(() => {}, 1000));
+
+Deno.bench("bench1", () => {});
+Deno.bench("bench2", () => {});
+Deno.bench("bench3", () => {});
diff --git a/tests/testdata/bench/collect.out b/tests/testdata/bench/collect.out
new file mode 100644
index 000000000..03c75922b
--- /dev/null
+++ b/tests/testdata/bench/collect.out
@@ -0,0 +1,18 @@
+Check [WILDCARD]/bench/collect/bench.ts
+Check [WILDCARD]/bench/collect/include/2_bench.ts
+Check [WILDCARD]/bench/collect/include/bench.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/collect/bench.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
+[WILDCARD]/bench/collect/include/2_bench.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
+[WILDCARD]/bench/collect/include/bench.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
diff --git a/tests/testdata/bench/collect/bench.ts b/tests/testdata/bench/collect/bench.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testdata/bench/collect/bench.ts
diff --git a/tests/testdata/bench/collect/deno.jsonc b/tests/testdata/bench/collect/deno.jsonc
new file mode 100644
index 000000000..7f8f190d3
--- /dev/null
+++ b/tests/testdata/bench/collect/deno.jsonc
@@ -0,0 +1,5 @@
+{
+ "bench": {
+ "exclude": ["./ignore"]
+ }
+}
diff --git a/tests/testdata/bench/collect/deno.malformed.jsonc b/tests/testdata/bench/collect/deno.malformed.jsonc
new file mode 100644
index 000000000..8e558fbcf
--- /dev/null
+++ b/tests/testdata/bench/collect/deno.malformed.jsonc
@@ -0,0 +1,5 @@
+{
+ "bench": {
+ "dont_know_this_field": {}
+ }
+}
diff --git a/tests/testdata/bench/collect/deno2.jsonc b/tests/testdata/bench/collect/deno2.jsonc
new file mode 100644
index 000000000..653ab1e31
--- /dev/null
+++ b/tests/testdata/bench/collect/deno2.jsonc
@@ -0,0 +1,6 @@
+{
+ "bench": {
+ "include": ["./include/"],
+ "exclude": ["./ignore", "./include/2_bench.ts"]
+ }
+}
diff --git a/tests/testdata/bench/collect/ignore/bench.ts b/tests/testdata/bench/collect/ignore/bench.ts
new file mode 100644
index 000000000..16fb63ba7
--- /dev/null
+++ b/tests/testdata/bench/collect/ignore/bench.ts
@@ -0,0 +1 @@
+throw new Error("this module should be ignored");
diff --git a/tests/testdata/bench/collect/include/2_bench.ts b/tests/testdata/bench/collect/include/2_bench.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testdata/bench/collect/include/2_bench.ts
diff --git a/tests/testdata/bench/collect/include/bench.ts b/tests/testdata/bench/collect/include/bench.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testdata/bench/collect/include/bench.ts
diff --git a/tests/testdata/bench/collect2.out b/tests/testdata/bench/collect2.out
new file mode 100644
index 000000000..00b8bfc0d
--- /dev/null
+++ b/tests/testdata/bench/collect2.out
@@ -0,0 +1,13 @@
+Check [WILDCARD]/bench/collect/bench.ts
+Check [WILDCARD]/bench/collect/include/bench.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/collect/bench.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
+[WILDCARD]/bench/collect/include/bench.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
diff --git a/tests/testdata/bench/collect_with_malformed_config.out b/tests/testdata/bench/collect_with_malformed_config.out
new file mode 100644
index 000000000..92e5e29d2
--- /dev/null
+++ b/tests/testdata/bench/collect_with_malformed_config.out
@@ -0,0 +1,4 @@
+error: Failed to parse "bench" configuration
+
+Caused by:
+ unknown field `dont_know_this_field`, expected one of `include`, `exclude`, `files`
diff --git a/tests/testdata/bench/exit_sanitizer.out b/tests/testdata/bench/exit_sanitizer.out
new file mode 100644
index 000000000..9f15d3f26
--- /dev/null
+++ b/tests/testdata/bench/exit_sanitizer.out
@@ -0,0 +1,14 @@
+Check [WILDCARD]/bench/exit_sanitizer.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/exit_sanitizer.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+exit(0) error: Error: Bench attempted to exit with exit code: 0
+[WILDCARD]
+exit(1) error: Error: Bench attempted to exit with exit code: 1
+[WILDCARD]
+exit(2) error: Error: Bench attempted to exit with exit code: 2
+[WILDCARD]
+error: Bench failed
diff --git a/tests/testdata/bench/exit_sanitizer.ts b/tests/testdata/bench/exit_sanitizer.ts
new file mode 100644
index 000000000..8e596b310
--- /dev/null
+++ b/tests/testdata/bench/exit_sanitizer.ts
@@ -0,0 +1,11 @@
+Deno.bench("exit(0)", function () {
+ Deno.exit(0);
+});
+
+Deno.bench("exit(1)", function () {
+ Deno.exit(1);
+});
+
+Deno.bench("exit(2)", function () {
+ Deno.exit(2);
+});
diff --git a/tests/testdata/bench/explicit_start_and_end.out b/tests/testdata/bench/explicit_start_and_end.out
new file mode 100644
index 000000000..fa118540c
--- /dev/null
+++ b/tests/testdata/bench/explicit_start_and_end.out
@@ -0,0 +1,25 @@
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/explicit_start_and_end.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+------------------------------------------------------------------- -----------------------------
+start and end [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+start only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+end only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+double start error: TypeError: BenchContext::start() has already been invoked.
+ t.start();
+ ^
+ at BenchContext.start ([WILDCARD])
+ at [WILDCARD]/explicit_start_and_end.ts:[WILDCARD]
+double end error: TypeError: BenchContext::end() has already been invoked.
+ t.end();
+ ^
+ at BenchContext.end ([WILDCARD])
+ at [WILDCARD]/explicit_start_and_end.ts:[WILDCARD]
+captured error: TypeError: The benchmark which this context belongs to is not being executed.
+ captured!.start();
+ ^
+ at BenchContext.start ([WILDCARD])
+ at [WILDCARD]/explicit_start_and_end.ts:[WILDCARD]
+error: Bench failed
diff --git a/tests/testdata/bench/explicit_start_and_end.ts b/tests/testdata/bench/explicit_start_and_end.ts
new file mode 100644
index 000000000..60a3d10d7
--- /dev/null
+++ b/tests/testdata/bench/explicit_start_and_end.ts
@@ -0,0 +1,50 @@
+Deno.bench("start and end", (t) => {
+ const id = setInterval(() => {}, 1000);
+ t.start();
+ Deno.inspect(id);
+ t.end();
+ clearInterval(id);
+});
+
+Deno.bench("start only", (t) => {
+ const id = setInterval(() => {}, 1000);
+ t.start();
+ Deno.inspect(id);
+ clearInterval(id);
+});
+
+Deno.bench("end only", (t) => {
+ const id = setInterval(() => {}, 1000);
+ Deno.inspect(id);
+ t.end();
+ clearInterval(id);
+});
+
+Deno.bench("double start", (t) => {
+ const id = setInterval(() => {}, 1000);
+ t.start();
+ t.start();
+ Deno.inspect(id);
+ t.end();
+ clearInterval(id);
+});
+
+let captured: Deno.BenchContext;
+
+Deno.bench("double end", (t) => {
+ captured = t;
+ const id = setInterval(() => {}, 1000);
+ t.start();
+ Deno.inspect(id);
+ t.end();
+ t.end();
+ clearInterval(id);
+});
+
+Deno.bench("captured", () => {
+ const id = setInterval(() => {}, 1000);
+ captured!.start();
+ Deno.inspect(id);
+ captured!.end();
+ clearInterval(id);
+});
diff --git a/tests/testdata/bench/explicit_start_and_end_low_precision.out b/tests/testdata/bench/explicit_start_and_end_low_precision.out
new file mode 100644
index 000000000..6dc66cfcc
--- /dev/null
+++ b/tests/testdata/bench/explicit_start_and_end_low_precision.out
@@ -0,0 +1,10 @@
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/explicit_start_and_end_low_precision.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+----------------------------------------------------------------------------- -----------------------------
+noop with start and end [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+Warning: start() and end() calls in "noop with start and end" are ignored because it averages less
+than 10µs per iteration. Remove them for better results.
+
diff --git a/tests/testdata/bench/explicit_start_and_end_low_precision.ts b/tests/testdata/bench/explicit_start_and_end_low_precision.ts
new file mode 100644
index 000000000..23bdf19fe
--- /dev/null
+++ b/tests/testdata/bench/explicit_start_and_end_low_precision.ts
@@ -0,0 +1,4 @@
+Deno.bench("noop with start and end", (b) => {
+ b.start();
+ b.end();
+});
diff --git a/tests/testdata/bench/fail.out b/tests/testdata/bench/fail.out
new file mode 100644
index 000000000..ff3c29b92
--- /dev/null
+++ b/tests/testdata/bench/fail.out
@@ -0,0 +1,28 @@
+Check [WILDCARD]/bench/fail.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/fail.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+bench0 error: Error
+[WILDCARD]
+bench1 error: Error
+[WILDCARD]
+bench2 error: Error
+[WILDCARD]
+bench3 error: Error
+[WILDCARD]
+bench4 error: Error
+[WILDCARD]
+bench5 error: Error
+[WILDCARD]
+bench6 error: Error
+[WILDCARD]
+bench7 error: Error
+[WILDCARD]
+bench8 error: Error
+[WILDCARD]
+bench9 error: Error
+[WILDCARD]
+error: Bench failed
diff --git a/tests/testdata/bench/fail.ts b/tests/testdata/bench/fail.ts
new file mode 100644
index 000000000..33d70ce55
--- /dev/null
+++ b/tests/testdata/bench/fail.ts
@@ -0,0 +1,30 @@
+Deno.bench("bench0", () => {
+ throw new Error();
+});
+Deno.bench("bench1", () => {
+ throw new Error();
+});
+Deno.bench("bench2", () => {
+ throw new Error();
+});
+Deno.bench("bench3", () => {
+ throw new Error();
+});
+Deno.bench("bench4", () => {
+ throw new Error();
+});
+Deno.bench("bench5", () => {
+ throw new Error();
+});
+Deno.bench("bench6", () => {
+ throw new Error();
+});
+Deno.bench("bench7", () => {
+ throw new Error();
+});
+Deno.bench("bench8", () => {
+ throw new Error();
+});
+Deno.bench("bench9", () => {
+ throw new Error();
+});
diff --git a/tests/testdata/bench/file_protocol.out b/tests/testdata/bench/file_protocol.out
new file mode 100644
index 000000000..7086c861c
--- /dev/null
+++ b/tests/testdata/bench/file_protocol.out
@@ -0,0 +1,8 @@
+Check file://[WILDCARD]/bench/file_protocol.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/file_protocol.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/file_protocol.ts b/tests/testdata/bench/file_protocol.ts
new file mode 100644
index 000000000..06a07bb38
--- /dev/null
+++ b/tests/testdata/bench/file_protocol.ts
@@ -0,0 +1 @@
+Deno.bench("bench0", () => {});
diff --git a/tests/testdata/bench/filter.out b/tests/testdata/bench/filter.out
new file mode 100644
index 000000000..970171e0b
--- /dev/null
+++ b/tests/testdata/bench/filter.out
@@ -0,0 +1,20 @@
+Check [WILDCARD]/bench/filter/a_bench.ts
+Check [WILDCARD]/bench/filter/b_bench.ts
+Check [WILDCARD]/bench/filter/c_bench.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/filter/a_bench.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+
+[WILDCARD]/bench/filter/b_bench.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+
+[WILDCARD]/bench/filter/c_bench.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/filter/a_bench.ts b/tests/testdata/bench/filter/a_bench.ts
new file mode 100644
index 000000000..fc4ef859c
--- /dev/null
+++ b/tests/testdata/bench/filter/a_bench.ts
@@ -0,0 +1,3 @@
+Deno.bench("foo", function () {});
+Deno.bench("bar", function () {});
+Deno.bench("baz", function () {});
diff --git a/tests/testdata/bench/filter/b_bench.ts b/tests/testdata/bench/filter/b_bench.ts
new file mode 100644
index 000000000..fc4ef859c
--- /dev/null
+++ b/tests/testdata/bench/filter/b_bench.ts
@@ -0,0 +1,3 @@
+Deno.bench("foo", function () {});
+Deno.bench("bar", function () {});
+Deno.bench("baz", function () {});
diff --git a/tests/testdata/bench/filter/c_bench.ts b/tests/testdata/bench/filter/c_bench.ts
new file mode 100644
index 000000000..fc4ef859c
--- /dev/null
+++ b/tests/testdata/bench/filter/c_bench.ts
@@ -0,0 +1,3 @@
+Deno.bench("foo", function () {});
+Deno.bench("bar", function () {});
+Deno.bench("baz", function () {});
diff --git a/tests/testdata/bench/finally_timeout.out b/tests/testdata/bench/finally_timeout.out
new file mode 100644
index 000000000..96bec017d
--- /dev/null
+++ b/tests/testdata/bench/finally_timeout.out
@@ -0,0 +1,11 @@
+Check [WILDCARD]/bench/finally_timeout.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/finally_timeout.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+error error: Error: fail
+[WILDCARD]
+success [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+error: Bench failed
diff --git a/tests/testdata/bench/finally_timeout.ts b/tests/testdata/bench/finally_timeout.ts
new file mode 100644
index 000000000..c49eb8da2
--- /dev/null
+++ b/tests/testdata/bench/finally_timeout.ts
@@ -0,0 +1,11 @@
+Deno.bench("error", function () {
+ const timer = setTimeout(() => null, 10000);
+ try {
+ throw new Error("fail");
+ } finally {
+ clearTimeout(timer);
+ }
+});
+
+Deno.bench("success", function () {
+});
diff --git a/tests/testdata/bench/group_baseline.out b/tests/testdata/bench/group_baseline.out
new file mode 100644
index 000000000..5de0ac1fe
--- /dev/null
+++ b/tests/testdata/bench/group_baseline.out
@@ -0,0 +1,20 @@
+[WILDCARD]/bench/group_baseline.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+-------------------------------------------------------------------- -----------------------------
+noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+
+summary
+ noo[WILDCARD]
+ [WILDCARD]x [WILDCARD] than noo[WILDCARD]
+
+group url
+noop3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+parse url 2x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+parse url 200x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+
+summary
+ parse url 2x
+ [WILDCARD]x slower than noop3
+ [WILDCARD]x faster than parse url 200x
+
diff --git a/tests/testdata/bench/group_baseline.ts b/tests/testdata/bench/group_baseline.ts
new file mode 100644
index 000000000..a86f6455c
--- /dev/null
+++ b/tests/testdata/bench/group_baseline.ts
@@ -0,0 +1,15 @@
+Deno.bench("noop", () => {});
+Deno.bench("noop2", { baseline: true }, () => {});
+
+Deno.bench("noop3", { group: "url" }, () => {});
+
+Deno.bench("parse url 2x", { group: "url", baseline: true }, () => {
+ new URL("https://deno.land/std/http/server.ts");
+ new URL("https://deno.land/std/http/server.ts");
+});
+
+Deno.bench("parse url 200x", { group: "url" }, () => {
+ for (let i = 0; i < 200; i++) {
+ new URL("https://deno.land/std/http/server.ts");
+ }
+});
diff --git a/tests/testdata/bench/ignore.out b/tests/testdata/bench/ignore.out
new file mode 100644
index 000000000..0693a7fc8
--- /dev/null
+++ b/tests/testdata/bench/ignore.out
@@ -0,0 +1,8 @@
+Check [WILDCARD]/bench/ignore.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/ignore.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
diff --git a/tests/testdata/bench/ignore.ts b/tests/testdata/bench/ignore.ts
new file mode 100644
index 000000000..0226fe76f
--- /dev/null
+++ b/tests/testdata/bench/ignore.ts
@@ -0,0 +1,9 @@
+for (let i = 0; i < 10; i++) {
+ Deno.bench({
+ name: `bench${i}`,
+ ignore: true,
+ fn() {
+ throw new Error("unreachable");
+ },
+ });
+}
diff --git a/tests/testdata/bench/ignore_permissions.out b/tests/testdata/bench/ignore_permissions.out
new file mode 100644
index 000000000..1c8e93535
--- /dev/null
+++ b/tests/testdata/bench/ignore_permissions.out
@@ -0,0 +1,8 @@
+Check [WILDCARD]/bench/ignore_permissions.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/ignore_permissions.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
diff --git a/tests/testdata/bench/ignore_permissions.ts b/tests/testdata/bench/ignore_permissions.ts
new file mode 100644
index 000000000..0dcd9299f
--- /dev/null
+++ b/tests/testdata/bench/ignore_permissions.ts
@@ -0,0 +1,16 @@
+Deno.bench({
+ name: "ignore",
+ permissions: {
+ read: true,
+ write: true,
+ net: true,
+ env: true,
+ run: true,
+ ffi: true,
+ hrtime: true,
+ },
+ ignore: true,
+ fn() {
+ throw new Error("unreachable");
+ },
+});
diff --git a/tests/testdata/bench/interval.out b/tests/testdata/bench/interval.out
new file mode 100644
index 000000000..389b89162
--- /dev/null
+++ b/tests/testdata/bench/interval.out
@@ -0,0 +1,8 @@
+Check [WILDCARD]/bench/interval.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/interval.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
diff --git a/tests/testdata/bench/interval.ts b/tests/testdata/bench/interval.ts
new file mode 100644
index 000000000..7eb588c59
--- /dev/null
+++ b/tests/testdata/bench/interval.ts
@@ -0,0 +1 @@
+setInterval(function () {}, 0);
diff --git a/tests/testdata/bench/load_unload.out b/tests/testdata/bench/load_unload.out
new file mode 100644
index 000000000..e5bc6b29e
--- /dev/null
+++ b/tests/testdata/bench/load_unload.out
@@ -0,0 +1,8 @@
+Check [WILDCARD]/bench/load_unload.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/load_unload.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+bench [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/load_unload.ts b/tests/testdata/bench/load_unload.ts
new file mode 100644
index 000000000..3653c135d
--- /dev/null
+++ b/tests/testdata/bench/load_unload.ts
@@ -0,0 +1,22 @@
+let interval: number | null = null;
+addEventListener("load", () => {
+ if (interval) {
+ throw new Error("Interval is already set");
+ }
+
+ interval = setInterval(() => {}, 0);
+});
+
+addEventListener("unload", () => {
+ if (!interval) {
+ throw new Error("Interval was not set");
+ }
+
+ clearInterval(interval);
+});
+
+Deno.bench("bench", () => {
+ if (!interval) {
+ throw new Error("Interval was not set");
+ }
+});
diff --git a/tests/testdata/bench/meta.out b/tests/testdata/bench/meta.out
new file mode 100644
index 000000000..8c9aa9123
--- /dev/null
+++ b/tests/testdata/bench/meta.out
@@ -0,0 +1,10 @@
+Check [WILDCARD]/bench/meta.ts
+import.meta.main: false
+import.meta.url: [WILDCARD]/bench/meta.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/meta.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+
diff --git a/tests/testdata/bench/meta.ts b/tests/testdata/bench/meta.ts
new file mode 100644
index 000000000..e32fdeea6
--- /dev/null
+++ b/tests/testdata/bench/meta.ts
@@ -0,0 +1,2 @@
+console.log("import.meta.main: %s", import.meta.main);
+console.log("import.meta.url: %s", import.meta.url);
diff --git a/tests/testdata/bench/multifile_summary.out b/tests/testdata/bench/multifile_summary.out
new file mode 100644
index 000000000..37aebe187
--- /dev/null
+++ b/tests/testdata/bench/multifile_summary.out
@@ -0,0 +1,64 @@
+Check [WILDCARD]/bench/group_baseline.ts
+Check [WILDCARD]/bench/pass.ts
+Check [WILDCARD]/bench/multiple_group.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/group_baseline.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+-------------------------------------------------------------------- -----------------------------
+noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+
+summary
+ noo[WILDCARD]
+ [WILDCARD]x [WILDCARD] than noo[WILDCARD]
+
+group url
+noop3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+parse url 2x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+parse url 200x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+
+summary
+ parse url 2x
+ [WILDCARD]x slower than noop3
+ [WILDCARD]x faster than parse url 200x
+
+
+[WILDCARD]/bench/pass.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench4 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench5 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench6 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench7 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench8 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench9 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+
+
+[WILDCARD]/bench/multiple_group.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+-------------------------------------------------------------------- -----------------------------
+
+group noop
+noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+
+summary
+ noo[WILDCARD]
+ [WILDCARD]x [WILDCARD] than noo[WILDCARD]
+
+group url
+noop3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+parse url 2x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+parse url 200x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+
+summary
+ parse url 2x
+ [WILDCARD]x slower than noop3
+ [WILDCARD]x faster than parse url 200x
+
diff --git a/tests/testdata/bench/multiple_group.ts b/tests/testdata/bench/multiple_group.ts
new file mode 100644
index 000000000..69e73a7f2
--- /dev/null
+++ b/tests/testdata/bench/multiple_group.ts
@@ -0,0 +1,15 @@
+Deno.bench("noop", { group: "noop" }, () => {});
+Deno.bench("noop2", { group: "noop", baseline: true }, () => {});
+
+Deno.bench("noop3", { group: "url" }, () => {});
+
+Deno.bench("parse url 2x", { group: "url", baseline: true }, () => {
+ new URL("https://deno.land/std/http/server.ts");
+ new URL("https://deno.land/std/http/server.ts");
+});
+
+Deno.bench("parse url 200x", { group: "url" }, () => {
+ for (let i = 0; i < 200; i++) {
+ new URL("https://deno.land/std/http/server.ts");
+ }
+});
diff --git a/tests/testdata/bench/no_check.out b/tests/testdata/bench/no_check.out
new file mode 100644
index 000000000..6dc016458
--- /dev/null
+++ b/tests/testdata/bench/no_check.out
@@ -0,0 +1,9 @@
+error: (in promise) TypeError: Cannot read properties of undefined (reading 'fn')
+Deno.bench();
+ ^
+ at [WILDCARD]
+ at [WILDCARD]/bench/no_check.ts:1:6
+This error was not caught from a benchmark and caused the bench runner to fail on the referenced module.
+It most likely originated from a dangling promise, event/timeout handler or top-level code.
+
+error: Bench failed
diff --git a/tests/testdata/bench/no_check.ts b/tests/testdata/bench/no_check.ts
new file mode 100644
index 000000000..b159cabd6
--- /dev/null
+++ b/tests/testdata/bench/no_check.ts
@@ -0,0 +1 @@
+Deno.bench();
diff --git a/tests/testdata/bench/no_color.ts b/tests/testdata/bench/no_color.ts
new file mode 100644
index 000000000..d15bf3572
--- /dev/null
+++ b/tests/testdata/bench/no_color.ts
@@ -0,0 +1,17 @@
+Deno.bench({
+ name: "success",
+ fn() {},
+});
+
+Deno.bench({
+ name: "fail",
+ fn() {
+ throw new Error("fail");
+ },
+});
+
+Deno.bench({
+ name: "ignored",
+ ignore: true,
+ fn() {},
+});
diff --git a/tests/testdata/bench/no_prompt_by_default.out b/tests/testdata/bench/no_prompt_by_default.out
new file mode 100644
index 000000000..4c7e7f146
--- /dev/null
+++ b/tests/testdata/bench/no_prompt_by_default.out
@@ -0,0 +1,9 @@
+[WILDCARD]cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/no_prompt_by_default.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+no prompt error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag
+[WILDCARD]
+error: Bench failed
diff --git a/tests/testdata/bench/no_prompt_by_default.ts b/tests/testdata/bench/no_prompt_by_default.ts
new file mode 100644
index 000000000..59359eebd
--- /dev/null
+++ b/tests/testdata/bench/no_prompt_by_default.ts
@@ -0,0 +1,3 @@
+Deno.bench("no prompt", async () => {
+ await Deno.readTextFile("./some_file.txt");
+});
diff --git a/tests/testdata/bench/no_prompt_with_denied_perms.out b/tests/testdata/bench/no_prompt_with_denied_perms.out
new file mode 100644
index 000000000..74400dafe
--- /dev/null
+++ b/tests/testdata/bench/no_prompt_with_denied_perms.out
@@ -0,0 +1,9 @@
+[WILDCARD]cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/no_prompt_with_denied_perms.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+no prompt error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag
+[WILDCARD]
+error: Bench failed
diff --git a/tests/testdata/bench/no_prompt_with_denied_perms.ts b/tests/testdata/bench/no_prompt_with_denied_perms.ts
new file mode 100644
index 000000000..2f0d63bbe
--- /dev/null
+++ b/tests/testdata/bench/no_prompt_with_denied_perms.ts
@@ -0,0 +1,3 @@
+Deno.bench("no prompt", { permissions: { read: false } }, async () => {
+ await Deno.readTextFile("./some_file.txt");
+});
diff --git a/tests/testdata/bench/no_run.out b/tests/testdata/bench/no_run.out
new file mode 100644
index 000000000..5d40f1d3b
--- /dev/null
+++ b/tests/testdata/bench/no_run.out
@@ -0,0 +1,5 @@
+Check [WILDCARD]/bench/no_run.ts
+error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+const _value: string = 1;
+ ~~~~~~
+ at [WILDCARD]/bench/no_run.ts:1:7
diff --git a/tests/testdata/bench/no_run.ts b/tests/testdata/bench/no_run.ts
new file mode 100644
index 000000000..c7a5dc1e8
--- /dev/null
+++ b/tests/testdata/bench/no_run.ts
@@ -0,0 +1,2 @@
+const _value: string = 1;
+console.log("this should not be run");
diff --git a/tests/testdata/bench/only.out b/tests/testdata/bench/only.out
new file mode 100644
index 000000000..00338af8e
--- /dev/null
+++ b/tests/testdata/bench/only.out
@@ -0,0 +1,9 @@
+Check [WILDCARD]/bench/only.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/only.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+error: Bench failed because the "only" option was used
diff --git a/tests/testdata/bench/only.ts b/tests/testdata/bench/only.ts
new file mode 100644
index 000000000..0129c024c
--- /dev/null
+++ b/tests/testdata/bench/only.ts
@@ -0,0 +1,15 @@
+Deno.bench({
+ name: "before",
+ fn() {},
+});
+
+Deno.bench({
+ only: true,
+ name: "only",
+ fn() {},
+});
+
+Deno.bench({
+ name: "after",
+ fn() {},
+});
diff --git a/tests/testdata/bench/overloads.out b/tests/testdata/bench/overloads.out
new file mode 100644
index 000000000..289c8dde6
--- /dev/null
+++ b/tests/testdata/bench/overloads.out
@@ -0,0 +1,12 @@
+Check [WILDCARD]/bench/overloads.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/overloads.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench4 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/overloads.ts b/tests/testdata/bench/overloads.ts
new file mode 100644
index 000000000..4f5887f79
--- /dev/null
+++ b/tests/testdata/bench/overloads.ts
@@ -0,0 +1,6 @@
+Deno.bench("bench0", () => {});
+Deno.bench(function bench1() {});
+Deno.bench({ name: "bench2", fn: () => {} });
+Deno.bench("bench3", { permissions: "none" }, () => {});
+Deno.bench({ name: "bench4" }, () => {});
+Deno.bench({ ignore: true }, function bench5() {});
diff --git a/tests/testdata/bench/pass.json.out b/tests/testdata/bench/pass.json.out
new file mode 100644
index 000000000..73daa7202
--- /dev/null
+++ b/tests/testdata/bench/pass.json.out
@@ -0,0 +1,28 @@
+Check file:///[WILDCARD]testdata/bench/pass.ts
+{
+ "runtime": "Deno/[WILDCARD]",
+ "cpu": "[WILDCARD]",
+ "benches": [
+ {
+ "origin": "file:///[WILDCARD]testdata/bench/pass.ts",
+ "group": null,
+ "name": "bench0",
+ "baseline": false,
+ "results": [
+ {
+ "ok": {
+ "n": [WILDCARD],
+ "min": [WILDCARD],
+ "max": [WILDCARD],
+ "avg": [WILDCARD],
+ "p75": [WILDCARD],
+ "p99": [WILDCARD],
+ "p995": [WILDCARD],
+ "p999": [WILDCARD]
+ }
+ }
+ ]
+ },
+[WILDCARD]
+ ]
+}
diff --git a/tests/testdata/bench/pass.out b/tests/testdata/bench/pass.out
new file mode 100644
index 000000000..19ea6fd13
--- /dev/null
+++ b/tests/testdata/bench/pass.out
@@ -0,0 +1,17 @@
+Check [WILDCARD]/bench/pass.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/pass.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+--------------------------------------------------------------- -----------------------------
+bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench4 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench5 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench6 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench7 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench8 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+bench9 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/pass.ts b/tests/testdata/bench/pass.ts
new file mode 100644
index 000000000..48348d447
--- /dev/null
+++ b/tests/testdata/bench/pass.ts
@@ -0,0 +1,10 @@
+Deno.bench("bench0", () => {});
+Deno.bench("bench1", () => {});
+Deno.bench("bench2", () => {});
+Deno.bench("bench3", () => {});
+Deno.bench("bench4", () => {});
+Deno.bench("bench5", () => {});
+Deno.bench("bench6", () => {});
+Deno.bench("bench7", () => {});
+Deno.bench("bench8", () => {});
+Deno.bench("bench9", () => {});
diff --git a/tests/testdata/bench/quiet.out b/tests/testdata/bench/quiet.out
new file mode 100644
index 000000000..ed9e06c84
--- /dev/null
+++ b/tests/testdata/bench/quiet.out
@@ -0,0 +1,10 @@
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/quiet.ts
+benchmark time (avg) iter/s (min … max) p75 p99 p995
+------------------------------------------------------------------- -----------------------------
+console.log [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+console.error [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+console.info [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
+console.warn [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/quiet.ts b/tests/testdata/bench/quiet.ts
new file mode 100644
index 000000000..efeb366ff
--- /dev/null
+++ b/tests/testdata/bench/quiet.ts
@@ -0,0 +1,15 @@
+Deno.bench("console.log", function () {
+ console.log("log");
+});
+
+Deno.bench("console.error", function () {
+ console.error("error");
+});
+
+Deno.bench("console.info", function () {
+ console.info("info");
+});
+
+Deno.bench("console.warn", function () {
+ console.info("warn");
+});
diff --git a/tests/testdata/bench/recursive_permissions_pledge.js b/tests/testdata/bench/recursive_permissions_pledge.js
new file mode 100644
index 000000000..9bf320c37
--- /dev/null
+++ b/tests/testdata/bench/recursive_permissions_pledge.js
@@ -0,0 +1,6 @@
+Deno[Deno.internal].core.ops.op_pledge_test_permissions(
+ "none",
+);
+Deno[Deno.internal].core.ops.op_pledge_test_permissions(
+ "inherit",
+);
diff --git a/tests/testdata/bench/unhandled_rejection.out b/tests/testdata/bench/unhandled_rejection.out
new file mode 100644
index 000000000..dba6d9ed4
--- /dev/null
+++ b/tests/testdata/bench/unhandled_rejection.out
@@ -0,0 +1,11 @@
+Check [WILDCARD]/bench/unhandled_rejection.ts
+error: (in promise) Error: rejection
+ reject(new Error("rejection"));
+ ^
+ at [WILDCARD]/bench/unhandled_rejection.ts:2:10
+ at new Promise (<anonymous>)
+ at [WILDCARD]/bench/unhandled_rejection.ts:1:1
+This error was not caught from a benchmark and caused the bench runner to fail on the referenced module.
+It most likely originated from a dangling promise, event/timeout handler or top-level code.
+
+error: Bench failed
diff --git a/tests/testdata/bench/unhandled_rejection.ts b/tests/testdata/bench/unhandled_rejection.ts
new file mode 100644
index 000000000..32f3111ea
--- /dev/null
+++ b/tests/testdata/bench/unhandled_rejection.ts
@@ -0,0 +1,3 @@
+new Promise((_resolve, reject) => {
+ reject(new Error("rejection"));
+});
diff --git a/tests/testdata/bench/unresolved_promise.out b/tests/testdata/bench/unresolved_promise.out
new file mode 100644
index 000000000..e5c53836a
--- /dev/null
+++ b/tests/testdata/bench/unresolved_promise.out
@@ -0,0 +1,9 @@
+Check [WILDCARD]/bench/unresolved_promise.ts
+error: Top-level await promise never resolved
+await new Promise((_resolve, _reject) => {});
+^
+ at <anonymous> ([WILDCARD]bench/unresolved_promise.ts:1:1)
+This error was not caught from a benchmark and caused the bench runner to fail on the referenced module.
+It most likely originated from a dangling promise, event/timeout handler or top-level code.
+
+error: Bench failed
diff --git a/tests/testdata/bench/unresolved_promise.ts b/tests/testdata/bench/unresolved_promise.ts
new file mode 100644
index 000000000..25fe70762
--- /dev/null
+++ b/tests/testdata/bench/unresolved_promise.ts
@@ -0,0 +1 @@
+await new Promise((_resolve, _reject) => {});