@@ -760,55 +760,55 @@ const createApiOptionTestCaseTitle: TitleFn<[RollupPluginSassOptions]> = (
760
760
test ( title , macro , TEST_PLUGIN_OPTIONS_DEFAULT_MODERN ) ;
761
761
}
762
762
763
- // {
764
- // const title =
765
- // 'should produces CSS modules alongside `insertStyle` if `cssModules` is returned from processor';
766
-
767
- // const macro = test.macro<[RollupPluginSassOptions]>({
768
- // async exec(t, pluginOptions) {
769
- // const outputBundle = await rollup({
770
- // input: 'test/fixtures/css-modules/index.js',
771
- // plugins: [
772
- // sass({
773
- // ...pluginOptions,
774
- // insert: true,
775
- // processor: postcssModulesProcessor,
776
- // }),
777
- // ],
778
- // });
779
-
780
- // const { output } = await outputBundle.generate(TEST_GENERATE_OPTIONS);
781
-
782
- // t.is(
783
- // output.length,
784
- // 1,
785
- // 'has 1 chunk (we are bundling all in one single file)',
786
- // );
787
-
788
- // const [{ moduleIds, modules }] = output;
789
-
790
- // t.is(
791
- // moduleIds.filter((it) => it.endsWith('insertStyle')).length,
792
- // 1,
793
- // 'include insertStyle one time',
794
- // );
795
-
796
- // const actualAModuleID = moduleIds.find((it) =>
797
- // it.endsWith('actual_a .scss'),
798
- // ) as string;
799
- // const actualAModule = modules[actualAModuleID ];
800
- // t.truthy(actualAModule );
801
- // t.snapshot(
802
- // actualAModule .code,
803
- // 'actual_a content is compiled with insertStyle',
804
- // );
805
- // },
806
- // title: createApiOptionTestCaseTitle,
807
- // });
808
-
809
- // test.only (title, macro, TEST_PLUGIN_OPTIONS_DEFAULT_LEGACY);
810
- // test(title, macro, TEST_PLUGIN_OPTIONS_DEFAULT_MODERN);
811
- // }
763
+ {
764
+ const title =
765
+ 'should produces CSS modules alongside `insertStyle` if `cssModules` is returned from processor' ;
766
+
767
+ const macro = test . macro < [ RollupPluginSassOptions ] > ( {
768
+ async exec ( t , pluginOptions ) {
769
+ const outputBundle = await rollup ( {
770
+ input : 'test/fixtures/css-modules/index.js' ,
771
+ plugins : [
772
+ sass ( {
773
+ ...pluginOptions ,
774
+ insert : true ,
775
+ processor : postcssModulesProcessor ,
776
+ } ) ,
777
+ ] ,
778
+ } ) ;
779
+
780
+ const { output } = await outputBundle . generate ( TEST_GENERATE_OPTIONS ) ;
781
+
782
+ t . is (
783
+ output . length ,
784
+ 1 ,
785
+ 'has 1 chunk (we are bundling all in one single file)' ,
786
+ ) ;
787
+
788
+ const [ { moduleIds, modules } ] = output ;
789
+
790
+ t . is (
791
+ moduleIds . filter ( ( it ) => it . endsWith ( 'insertStyle' ) ) . length ,
792
+ 1 ,
793
+ 'include insertStyle one time' ,
794
+ ) ;
795
+
796
+ const styleModuleID = moduleIds . find ( ( it ) =>
797
+ it . endsWith ( 'style .scss' ) ,
798
+ ) as string ;
799
+ const styleModule = modules [ styleModuleID ] ;
800
+ t . truthy ( styleModule ) ;
801
+ t . snapshot (
802
+ styleModule . code ,
803
+ 'style content is compiled with insertStyle',
804
+ ) ;
805
+ } ,
806
+ title : createApiOptionTestCaseTitle ,
807
+ } ) ;
808
+
809
+ test ( title , macro , TEST_PLUGIN_OPTIONS_DEFAULT_LEGACY ) ;
810
+ test ( title , macro , TEST_PLUGIN_OPTIONS_DEFAULT_MODERN ) ;
811
+ }
812
812
813
813
{
814
814
const title = 'should throw error when CSS modules is not an object' ;
0 commit comments