@@ -163,4 +163,89 @@ describe('limit option', () => {
163163
164164 expect ( source ) . toMatchSnapshot ( ) ;
165165 } ) ;
166+
167+ it ( '0 ({String})' , async ( ) => {
168+ // Image size is 6777
169+ const config = {
170+ loader : {
171+ test : / \. p n g $ / ,
172+ options : {
173+ limit : '0' ,
174+ } ,
175+ } ,
176+ } ;
177+
178+ const stats = await webpack ( 'fixture.js' , config ) ;
179+ const [ { source } ] = stats . toJson ( ) . modules ;
180+
181+ expect ( source ) . toMatchSnapshot ( ) ;
182+ } ) ;
183+
184+ it ( '0.1 ({String})' , async ( ) => {
185+ // Image size is 6777
186+ const config = {
187+ loader : {
188+ test : / \. p n g $ / ,
189+ options : {
190+ limit : '0.1' ,
191+ } ,
192+ } ,
193+ } ;
194+
195+ const stats = await webpack ( 'fixture.js' , config ) ;
196+ const [ { source } ] = stats . toJson ( ) . modules ;
197+
198+ expect ( source ) . toMatchSnapshot ( ) ;
199+ } ) ;
200+
201+ it ( '6776 ({String})' , async ( ) => {
202+ // Image size is 6777
203+ const config = {
204+ loader : {
205+ test : / \. p n g $ / ,
206+ options : {
207+ limit : '6776' ,
208+ } ,
209+ } ,
210+ } ;
211+
212+ const stats = await webpack ( 'fixture.js' , config ) ;
213+ const [ { source } ] = stats . toJson ( ) . modules ;
214+
215+ expect ( source ) . toMatchSnapshot ( ) ;
216+ } ) ;
217+
218+ it ( '6777 ({String})' , async ( ) => {
219+ // Image size is 6777
220+ const config = {
221+ loader : {
222+ test : / \. p n g $ / ,
223+ options : {
224+ limit : '6777' ,
225+ } ,
226+ } ,
227+ } ;
228+
229+ const stats = await webpack ( 'fixture.js' , config ) ;
230+ const [ { source } ] = stats . toJson ( ) . modules ;
231+
232+ expect ( source ) . toMatchSnapshot ( ) ;
233+ } ) ;
234+
235+ it ( '6778 ({String})' , async ( ) => {
236+ // Image size is 6777
237+ const config = {
238+ loader : {
239+ test : / \. p n g $ / ,
240+ options : {
241+ limit : '6778' ,
242+ } ,
243+ } ,
244+ } ;
245+
246+ const stats = await webpack ( 'fixture.js' , config ) ;
247+ const [ { source } ] = stats . toJson ( ) . modules ;
248+
249+ expect ( source ) . toMatchSnapshot ( ) ;
250+ } ) ;
166251} ) ;
0 commit comments