@@ -255,4 +255,69 @@ describe("Main node files", function () {
255
255
] ) ;
256
256
} ) ;
257
257
258
+ it ( 'should return all packages if skip section is empty in config' , ( ) => {
259
+ const options = {
260
+ packageJsonPath : './spec/main.skip.package.json' ,
261
+ nodeModulesPath : './spec/test_node_modules'
262
+ } ;
263
+ const files = getMainNodeFiles ( options ) ;
264
+
265
+ expect ( files ) . toEqual ( [
266
+ './spec/test_node_modules/test-module-1/index.js' ,
267
+ './spec/test_node_modules/test-module-2/main.js' ,
268
+ './spec/test_node_modules/test-module-3/index.js' ,
269
+ './spec/test_node_modules/test-module-4/index.js' ,
270
+ ] ) ;
271
+ } ) ;
272
+
273
+ it ( 'should skip package if there\'s true value for this package in skip section' , ( ) => {
274
+ const options = {
275
+ packageJsonPath : './spec/main.skip.package.json' ,
276
+ nodeModulesPath : './spec/test_node_modules' ,
277
+ skip : {
278
+ 'test-module-1' : true
279
+ }
280
+ } ;
281
+ const files = getMainNodeFiles ( options ) ;
282
+
283
+ expect ( files ) . toEqual ( [
284
+ './spec/test_node_modules/test-module-2/main.js' ,
285
+ './spec/test_node_modules/test-module-3/index.js' ,
286
+ './spec/test_node_modules/test-module-4/index.js' ,
287
+ ] ) ;
288
+ } ) ;
289
+
290
+ it ( 'should not skip package if there\'s false value for this package in skip section' , ( ) => {
291
+ const options = {
292
+ packageJsonPath : './spec/main.skip.package.json' ,
293
+ nodeModulesPath : './spec/test_node_modules' ,
294
+ skip : {
295
+ 'test-module-1' : false
296
+ }
297
+ } ;
298
+ const files = getMainNodeFiles ( options ) ;
299
+
300
+ expect ( files ) . toEqual ( [
301
+ './spec/test_node_modules/test-module-1/index.js' ,
302
+ './spec/test_node_modules/test-module-2/main.js' ,
303
+ './spec/test_node_modules/test-module-3/index.js' ,
304
+ './spec/test_node_modules/test-module-4/index.js' ,
305
+ ] ) ;
306
+ } ) ;
307
+
308
+ it ( 'should support skipping for scoped packages' , ( ) => {
309
+ const options = {
310
+ packageJsonPath : './spec/scoped.skip.package.json' ,
311
+ nodeModulesPath : './spec/test_node_modules' ,
312
+ skip : {
313
+ '@scoped/module-1' : true ,
314
+ }
315
+ } ;
316
+ const files = getMainNodeFiles ( options ) ;
317
+
318
+ expect ( files ) . toEqual ( [
319
+ './spec/test_node_modules/@scoped/module-2/index.js' ,
320
+ ] ) ;
321
+ } ) ;
322
+
258
323
} ) ;
0 commit comments