@@ -13,7 +13,6 @@ import {
1313
1414describe ( '"importLoaders" option' , ( ) => {
1515 it ( 'should work when not specified' , async ( ) => {
16- // It is hard to test `postcss` on reuse `ast`, please look on coverage before merging
1716 const compiler = getCompiler (
1817 './nested-import/source.js' ,
1918 { } ,
@@ -47,7 +46,6 @@ describe('"importLoaders" option', () => {
4746 } ) ;
4847
4948 it ( 'should work with a value equal to "0" (`postcss-loader` before)' , async ( ) => {
50- // It is hard to test `postcss` on reuse `ast`, please look on coverage before merging
5149 const compiler = getCompiler (
5250 './nested-import/source.js' ,
5351 { } ,
@@ -98,7 +96,6 @@ describe('"importLoaders" option', () => {
9896 } ) ;
9997
10098 it ( 'should work with a value equal to "1" ("postcss-loader" before)' , async ( ) => {
101- // It is hard to test `postcss` on reuse `ast`, please look on coverage before merging
10299 const compiler = getCompiler (
103100 './nested-import/source.js' ,
104101 { } ,
@@ -135,7 +132,6 @@ describe('"importLoaders" option', () => {
135132 } ) ;
136133
137134 it ( 'should work with a value equal to "2" ("postcss-loader" before)' , async ( ) => {
138- // It is hard to test `postcss` on reuse `ast`, please look on coverage before merging
139135 const compiler = getCompiler (
140136 './nested-import/source.js' ,
141137 { } ,
@@ -170,4 +166,40 @@ describe('"importLoaders" option', () => {
170166 expect ( getWarnings ( stats ) ) . toMatchSnapshot ( 'warnings' ) ;
171167 expect ( getErrors ( stats ) ) . toMatchSnapshot ( 'errors' ) ;
172168 } ) ;
169+
170+ it ( 'should work with a value equal to ""1"" ("postcss-loader" before)' , async ( ) => {
171+ const compiler = getCompiler (
172+ './nested-import/source.js' ,
173+ { } ,
174+ {
175+ module : {
176+ rules : [
177+ {
178+ test : / \. c s s $ / i,
179+ use : [
180+ {
181+ loader : path . resolve ( __dirname , '../src' ) ,
182+ options : { importLoaders : '1' } ,
183+ } ,
184+ {
185+ loader : 'postcss-loader' ,
186+ options : { plugins : ( ) => [ postcssPresetEnv ( { stage : 0 } ) ] } ,
187+ } ,
188+ ] ,
189+ } ,
190+ ] ,
191+ } ,
192+ }
193+ ) ;
194+ const stats = await compile ( compiler ) ;
195+
196+ expect (
197+ getModuleSource ( './nested-import/source.css' , stats )
198+ ) . toMatchSnapshot ( 'module' ) ;
199+ expect ( getExecutedCode ( 'main.bundle.js' , compiler , stats ) ) . toMatchSnapshot (
200+ 'result'
201+ ) ;
202+ expect ( getWarnings ( stats ) ) . toMatchSnapshot ( 'warnings' ) ;
203+ expect ( getErrors ( stats ) ) . toMatchSnapshot ( 'errors' ) ;
204+ } ) ;
173205} ) ;
0 commit comments