summaryrefslogtreecommitdiff
path: root/std/testing/bench_test.ts
diff options
context:
space:
mode:
authorSzalay Kristóf <32012862+littletof@users.noreply.github.com>2020-06-09 17:19:06 +0200
committerGitHub <noreply@github.com>2020-06-09 11:19:06 -0400
commit6e75254abb1d97541b1ce7a924a3e1c014807fff (patch)
treed4629c40c45e8402cdb3500ec3e14885fe51334d /std/testing/bench_test.ts
parent6c21ba05752c6d645c891fa8d90781f943f0f74c (diff)
fix(std/testing/bench): Make progress callback async (#6175)
Diffstat (limited to 'std/testing/bench_test.ts')
-rw-r--r--std/testing/bench_test.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/std/testing/bench_test.ts b/std/testing/bench_test.ts
index a56d4fd55..0b101c22f 100644
--- a/std/testing/bench_test.ts
+++ b/std/testing/bench_test.ts
@@ -338,6 +338,27 @@ test({
},
});
+test({
+ name: "async progressCallback",
+ fn: async function (): Promise<void> {
+ clearBenchmarks();
+ dummyBench("single");
+
+ const asyncCallbacks = [];
+
+ await runBenchmarks({ silent: true }, (progress) => {
+ return new Promise((resolve) => {
+ queueMicrotask(() => {
+ asyncCallbacks.push(progress);
+ resolve();
+ });
+ });
+ });
+
+ assertEquals(asyncCallbacks.length, 5);
+ },
+});
+
function dummyBench(name: string, runs = 1): void {
bench({
name,