@@ -12,19 +12,29 @@ test('inspect command', async () => {
1212 cwd : __dirname ,
1313 } ) ;
1414
15- const files = await globContentJSON ( path . join ( __dirname , 'dist' ) ) ;
16- const fileNames = Object . keys ( files ) ;
15+ const files = await globContentJSON ( path . join ( __dirname , 'dist/.rsbuild ' ) ) ;
16+ const fileNames = Object . keys ( files ) . sort ( ) ;
1717
18- const rsbuildConfig = fileNames . find ( ( item ) =>
19- item . includes ( 'rsbuild.config.mjs' ) ,
20- ) ;
18+ expect ( fileNames ) . toMatchInlineSnapshot ( `
19+ [
20+ "<ROOT>/tests/integration/cli/dist/.rsbuild/rsbuild.config.cjs.mjs",
21+ "<ROOT>/tests/integration/cli/dist/.rsbuild/rsbuild.config.esm.mjs",
22+ "<ROOT>/tests/integration/cli/dist/.rsbuild/rspack.config.cjs.mjs",
23+ "<ROOT>/tests/integration/cli/dist/.rsbuild/rspack.config.esm.mjs",
24+ ]
25+ ` ) ;
2126
22- expect ( rsbuildConfig ) . toBeTruthy ( ) ;
23- expect ( files [ rsbuildConfig ! ] ) . toContain ( "type: 'modern-module'" ) ;
27+ // esm rsbuild config
28+ const rsbuildConfigEsm = fileNames . find ( ( item ) =>
29+ item . includes ( 'rsbuild.config.esm.mjs' ) ,
30+ ) ;
31+ expect ( rsbuildConfigEsm ) . toBeTruthy ( ) ;
32+ expect ( files [ rsbuildConfigEsm ! ] ) . toContain ( "type: 'modern-module'" ) ;
2433
25- const rspackConfig = fileNames . find ( ( item ) =>
34+ // esm rspack config
35+ const rspackConfigEsm = fileNames . find ( ( item ) =>
2636 item . includes ( 'rspack.config.esm.mjs' ) ,
2737 ) ;
28- expect ( rspackConfig ) . toBeTruthy ( ) ;
29- expect ( files [ rspackConfig ! ] ) . toContain ( "type: 'modern-module'" ) ;
38+ expect ( rspackConfigEsm ) . toBeTruthy ( ) ;
39+ expect ( files [ rspackConfigEsm ! ] ) . toContain ( "type: 'modern-module'" ) ;
3040} ) ;
0 commit comments