@@ -446,7 +446,7 @@ describe('Dependency checks (eslint)', () => {
446
446
) ;
447
447
expect ( failures . length ) . toEqual ( 1 ) ;
448
448
expect ( failures [ 0 ] . message ) . toMatchInlineSnapshot ( `
449
- "The "liba" project uses the following packages, but they are missing from the "dependencies":
449
+ "The "liba" project uses the following packages, but they are missing from "dependencies":
450
450
- external2"
451
451
` ) ;
452
452
expect ( failures [ 0 ] . line ) . toEqual ( 3 ) ;
@@ -1462,11 +1462,63 @@ describe('Dependency checks (eslint)', () => {
1462
1462
) ;
1463
1463
expect ( failures . length ) . toEqual ( 1 ) ;
1464
1464
expect ( failures [ 0 ] . message ) . toMatchInlineSnapshot ( `
1465
- "The "liba" project uses the following packages, but they are missing from the "dependencies":
1465
+ "The "liba" project uses the following packages, but they are missing from "dependencies":
1466
1466
- tslib"
1467
1467
` ) ;
1468
1468
expect ( failures [ 0 ] . line ) . toEqual ( 3 ) ;
1469
1469
} ) ;
1470
+
1471
+ it ( 'should report missing package if it is in devDependencies' , ( ) => {
1472
+ const packageJson = {
1473
+ name : '@mycompany/liba' ,
1474
+ dependencies : { } ,
1475
+ devDependencies : {
1476
+ external1 : '^16.0.0' ,
1477
+ } ,
1478
+ } ;
1479
+
1480
+ const fileSys = {
1481
+ './libs/liba/package.json' : JSON . stringify ( packageJson , null , 2 ) ,
1482
+ './libs/liba/src/index.ts' : '' ,
1483
+ './package.json' : JSON . stringify ( rootPackageJson , null , 2 ) ,
1484
+ } ;
1485
+ vol . fromJSON ( fileSys , '/root' ) ;
1486
+
1487
+ const failures = runRule (
1488
+ { } ,
1489
+ `/root/libs/liba/package.json` ,
1490
+ JSON . stringify ( packageJson , null , 2 ) ,
1491
+ {
1492
+ nodes : {
1493
+ liba : {
1494
+ name : 'liba' ,
1495
+ type : 'lib' ,
1496
+ data : {
1497
+ root : 'libs/liba' ,
1498
+ targets : {
1499
+ build : { } ,
1500
+ } ,
1501
+ } ,
1502
+ } ,
1503
+ } ,
1504
+ externalNodes,
1505
+ dependencies : {
1506
+ liba : [ { source : 'liba' , target : 'npm:external1' , type : 'static' } ] ,
1507
+ } ,
1508
+ } ,
1509
+ {
1510
+ liba : [
1511
+ createFile ( `libs/liba/src/main.ts` , [ 'npm:external1' ] ) ,
1512
+ createFile ( `libs/liba/package.json` ) ,
1513
+ ] ,
1514
+ }
1515
+ ) ;
1516
+ expect ( failures . length ) . toEqual ( 1 ) ;
1517
+ expect ( failures [ 0 ] . message ) . toMatchInlineSnapshot ( `
1518
+ "The "liba" project uses the following packages, but they are missing from "dependencies":
1519
+ - external1"
1520
+ ` ) ;
1521
+ } ) ;
1470
1522
} ) ;
1471
1523
1472
1524
it ( 'should require swc if @nx/js:swc executor' , ( ) => {
@@ -1525,8 +1577,8 @@ it('should require swc if @nx/js:swc executor', () => {
1525
1577
) ;
1526
1578
expect ( failures . length ) . toEqual ( 1 ) ;
1527
1579
expect ( failures [ 0 ] . message ) . toMatchInlineSnapshot ( `
1528
- "The "liba" project uses the following packages, but they are missing from the "dependencies":
1529
- - @swc/helpers"
1580
+ "The "liba" project uses the following packages, but they are missing from "dependencies":
1581
+ - @swc/helpers"
1530
1582
` ) ;
1531
1583
expect ( failures [ 0 ] . line ) . toEqual ( 3 ) ;
1532
1584
} ) ;
0 commit comments