Skip to content

Commit f65a4ef

Browse files
committed
Add jest-bench benchmarking tool
1 parent b1ba4e1 commit f65a4ef

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ out
1313
tsconfig.tsbuildinfo
1414

1515
# Jest coverage results
16-
coverage
16+
coverage
17+
18+
# Jest-bench results
19+
benchmarks

bench.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import config from "./jest.config"
2+
3+
export default {
4+
...config,
5+
// Jest-bench need its own test environment to function
6+
"testEnvironment": "jest-bench/environment",
7+
"testEnvironmentOptions": {
8+
// still Jest-bench environment will run your environment if you specify it here
9+
testEnvironment: "jest-environment-node",
10+
"testEnvironmentOptions": {
11+
// specify any option for your environment
12+
}
13+
},
14+
// always include "default" reporter along with Jest-bench reporter
15+
// for error reporting
16+
"reporters": ["default", "jest-bench/reporter"],
17+
// will pick up "*.bench.js" files or files in "__benchmarks__" folder.
18+
"testRegex": "(/__benchmarks__/.*|\\.bench)\\.(ts|js)$"
19+
};

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"compile": "tsc -p ./src",
3939
"watch": "tsc -watch -p ./src",
4040
"test": "jest --projects jest.config.ts",
41+
"benchmark": "jest --projects bench.config.ts",
4142
"lint": "eslint ./src",
4243
"deploy": "vsce publish"
4344
},

0 commit comments

Comments
 (0)