@@ -13,7 +13,6 @@ import {
13
13
14
14
describe ( '"importLoaders" option' , ( ) => {
15
15
it ( 'should work when not specified' , async ( ) => {
16
- // It is hard to test `postcss` on reuse `ast`, please look on coverage before merging
17
16
const compiler = getCompiler (
18
17
'./nested-import/source.js' ,
19
18
{ } ,
@@ -47,7 +46,6 @@ describe('"importLoaders" option', () => {
47
46
} ) ;
48
47
49
48
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
51
49
const compiler = getCompiler (
52
50
'./nested-import/source.js' ,
53
51
{ } ,
@@ -98,7 +96,6 @@ describe('"importLoaders" option', () => {
98
96
} ) ;
99
97
100
98
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
102
99
const compiler = getCompiler (
103
100
'./nested-import/source.js' ,
104
101
{ } ,
@@ -135,7 +132,6 @@ describe('"importLoaders" option', () => {
135
132
} ) ;
136
133
137
134
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
139
135
const compiler = getCompiler (
140
136
'./nested-import/source.js' ,
141
137
{ } ,
@@ -170,4 +166,40 @@ describe('"importLoaders" option', () => {
170
166
expect ( getWarnings ( stats ) ) . toMatchSnapshot ( 'warnings' ) ;
171
167
expect ( getErrors ( stats ) ) . toMatchSnapshot ( 'errors' ) ;
172
168
} ) ;
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
+ } ) ;
173
205
} ) ;
0 commit comments