Skip to content

Commit 9bc1bc0

Browse files
committed
fix node benchmark
1 parent 652eb41 commit 9bc1bc0

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

benchmark/browser.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import { prepareTests, resultsToMarkdown, runTestAsync, TestResult, TestInterface } from "./benchmark";
2-
import { tests } from "./tests";
1+
import { prepareTests, resultsToMarkdown, runTestAsync, TestResult, TestInterface, TestFactory } from "./benchmark";
2+
import { box2dJsFactory } from "./tests/box2d-js";
3+
import { planckFactory } from "./tests/planck";
34

5+
export const tests: TestFactory[] = [
6+
box2dJsFactory,
7+
planckFactory,
8+
];
9+
410
export function getBrowserInfo() {
511
const ua = navigator.userAgent;
612
let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) ?? [];

benchmark/node.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { performance } from "perf_hooks";
22
global.performance = performance as any;
33

44
import { logResults, runAllTests } from "./benchmark";
5-
import { tests } from "./tests";
5+
import type { TestFactory } from "./benchmark";
6+
import { planckFactory } from "./tests/planck";
7+
8+
export const tests: TestFactory[] = [
9+
planckFactory,
10+
];
611

712
const results = runAllTests(tests);
813
logResults(results);

benchmark/tests/index.ts

-9
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"dev": "vite",
9696
"vite-build": "vite build",
9797
"vite-preview": "vite preview",
98-
"benchmark": "git log -n 1 && node --loader ts-node/esm ./benchmark/cli/index",
98+
"benchmark": "git log -n 1 && vite-node ./benchmark/node",
9999
"typedoc": "typedoc --options typedoc.json"
100100
}
101101
}

0 commit comments

Comments
 (0)