-
Notifications
You must be signed in to change notification settings - Fork 204
Expand file tree
/
Copy pathvitest.bench.config.ts
More file actions
25 lines (23 loc) · 867 Bytes
/
vitest.bench.config.ts
File metadata and controls
25 lines (23 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vitest/config';
const root = dirname(fileURLToPath(import.meta.url));
const nodeEntry = resolve(root, 'src/index.node.ts');
// The bench imports the public API via the virtual `node-rsa-bench-entry`
// specifier, which resolves to the node bundle. The three modes (`node`,
// `js-jsbn`, `js-native`) are selected per-bench via constructor options —
// no separate project per bundle is needed, since the digest/RNG backend
// is always native to the runtime.
export default defineConfig({
resolve: {
alias: { 'node-rsa-bench-entry': nodeEntry },
},
test: {
name: 'bench',
environment: 'node',
env: { NODE_RSA_BENCH_MODES: 'node,js-jsbn,js-native' },
benchmark: {
include: ['bench/**/*.bench.ts'],
},
},
});