Skip to content

Commit f161e19

Browse files
authored
chore(infra/bench): remove getCwdByExample stack in bench (#315)
1 parent 9bbd04b commit f161e19

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

tests/benchmark/index.bench.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,55 @@ const onlyEnableMF = (rslibConfig: RslibConfig) => {
2121

2222
const iterations = process.env.CI ? 10 : 50;
2323

24-
describe('benchmark Rslib in examples', () => {
24+
const exampleCwd = {
25+
'express-plugin': getCwdByExample('express-plugin'),
26+
'react-component-bundle': getCwdByExample('react-component-bundle'),
27+
'react-component-bundle-false': getCwdByExample(
28+
'react-component-bundle-false',
29+
),
30+
'react-component-umd': getCwdByExample('react-component-bundle-false'),
31+
'module-federation/mf-react-component': getCwdByExample(
32+
'module-federation/mf-react-component',
33+
),
34+
};
35+
36+
describe('benchmark Rslib in examples', async () => {
2537
bench(
2638
'examples/express-plugin',
2739
async () => {
28-
const cwd = getCwdByExample('express-plugin');
40+
const cwd = exampleCwd['express-plugin'];
2941
await rslibBuild({ cwd, modifyConfig: disableDts });
3042
},
3143
{ iterations },
3244
);
3345
bench(
3446
'examples/react-component-bundle',
3547
async () => {
36-
const cwd = getCwdByExample('react-component-bundle');
48+
const cwd = exampleCwd['react-component-bundle'];
3749
await rslibBuild({ cwd, modifyConfig: disableDts });
3850
},
3951
{ iterations },
4052
);
4153
bench(
4254
'examples/react-component-bundle-false',
4355
async () => {
44-
const cwd = getCwdByExample('react-component-bundle-false');
56+
const cwd = exampleCwd['react-component-bundle-false'];
4557
await rslibBuild({ cwd, modifyConfig: disableDts });
4658
},
4759
{ iterations },
4860
);
4961
bench(
5062
'examples/react-component-umd',
5163
async () => {
52-
const cwd = getCwdByExample('react-component-bundle-false');
64+
const cwd = exampleCwd['react-component-bundle-false'];
5365
await rslibBuild({ cwd, modifyConfig: disableDts });
5466
},
5567
{ iterations },
5668
);
5769
bench(
5870
'examples/module-federation/mf-react-component',
5971
async () => {
60-
const cwd = getCwdByExample('module-federation/mf-react-component');
72+
const cwd = exampleCwd['module-federation/mf-react-component'];
6173
await rslibBuild({ cwd, modifyConfig: onlyEnableMF });
6274
},
6375
{ iterations },

0 commit comments

Comments
 (0)