@@ -45,7 +45,7 @@ const fsMocks = {
45
45
'node:fs' : mockFs ,
46
46
}
47
47
48
- const { definitions, shorthands, flatten } = t . mock ( '../lib/definitions/index.js' , fsMocks )
48
+ const { definitions, shorthands, nerfDarts , flatten } = t . mock ( '../lib/definitions/index.js' , fsMocks )
49
49
const Config = t . mock ( '../' , fsMocks )
50
50
51
51
// because we used t.mock above, the require cache gets blown and we lose our direct equality
@@ -381,6 +381,8 @@ loglevel = yolo
381
381
// warn logs are emitted as a side effect of validate
382
382
config . validate ( )
383
383
t . strictSame ( logs . filter ( l => l [ 0 ] === 'warn' ) , [
384
+ [ 'warn' , 'Unknown builtin config "builtin-config". This will stop working in the next major version of npm.' ] ,
385
+ [ 'warn' , 'Unknown builtin config "foo". This will stop working in the next major version of npm.' ] ,
384
386
[ 'warn' , 'invalid config' , 'registry="hello"' , 'set in command line options' ] ,
385
387
[ 'warn' , 'invalid config' , 'Must be' , 'full url with "http://"' ] ,
386
388
[ 'warn' , 'invalid config' , 'proxy="hello"' , 'set in command line options' ] ,
@@ -397,6 +399,13 @@ loglevel = yolo
397
399
[ 'warn' , 'invalid config' , 'prefix=true' , 'set in command line options' ] ,
398
400
[ 'warn' , 'invalid config' , 'Must be' , 'valid filesystem path' ] ,
399
401
[ 'warn' , 'config' , 'also' , 'Please use --include=dev instead.' ] ,
402
+ [ 'warn' , 'Unknown env config "foo". This will stop working in the next major version of npm.' ] ,
403
+ [ 'warn' , 'Unknown project config "project-config". This will stop working in the next major version of npm.' ] ,
404
+ [ 'warn' , 'Unknown project config "foo". This will stop working in the next major version of npm.' ] ,
405
+ [ 'warn' , 'Unknown user config "user-config-from-builtin". This will stop working in the next major version of npm.' ] ,
406
+ [ 'warn' , 'Unknown user config "foo". This will stop working in the next major version of npm.' ] ,
407
+ [ 'warn' , 'Unknown global config "global-config". This will stop working in the next major version of npm.' ] ,
408
+ [ 'warn' , 'Unknown global config "foo". This will stop working in the next major version of npm.' ] ,
400
409
[ 'warn' , 'invalid config' , 'loglevel="yolo"' , `set in ${ resolve ( path , 'project/.npmrc' ) } ` ] ,
401
410
[ 'warn' , 'invalid config' , 'Must be one of:' ,
402
411
[ 'silent' , 'error' , 'warn' , 'notice' , 'http' , 'info' , 'verbose' , 'silly' ] . join ( ', ' ) ,
@@ -591,6 +600,12 @@ loglevel = yolo
591
600
[ 'warn' , 'invalid config' , 'prefix=true' , 'set in command line options' ] ,
592
601
[ 'warn' , 'invalid config' , 'Must be' , 'valid filesystem path' ] ,
593
602
[ 'warn' , 'config' , 'also' , 'Please use --include=dev instead.' ] ,
603
+ [ 'warn' , 'Unknown env config "foo". This will stop working in the next major version of npm.' ] ,
604
+ [ 'warn' , 'Unknown user config "default-user-config-in-home". This will stop working in the next major version of npm.' ] ,
605
+ [ 'warn' , 'Unknown user config "foo". This will stop working in the next major version of npm.' ] ,
606
+ [ 'warn' , 'Unknown global config "global-config". This will stop working in the next major version of npm.' ] ,
607
+ [ 'warn' , 'Unknown global config "foo". This will stop working in the next major version of npm.' ] ,
608
+ [ 'warn' , 'Unknown global config "asdf". This will stop working in the next major version of npm.' ] ,
594
609
] )
595
610
logs . length = 0
596
611
} )
@@ -1228,6 +1243,7 @@ t.test('workspaces', async (t) => {
1228
1243
cwd : join ( `${ path } /workspaces/three` ) ,
1229
1244
shorthands,
1230
1245
definitions,
1246
+ nerfDarts,
1231
1247
} )
1232
1248
1233
1249
await config . load ( )
@@ -1253,6 +1269,7 @@ t.test('workspaces', async (t) => {
1253
1269
cwd : join ( `${ path } /workspaces/one` ) ,
1254
1270
shorthands,
1255
1271
definitions,
1272
+ nerfDarts,
1256
1273
} )
1257
1274
1258
1275
await config . load ( )
@@ -1274,6 +1291,7 @@ t.test('workspaces', async (t) => {
1274
1291
cwd : join ( `${ path } /workspaces/one` ) ,
1275
1292
shorthands,
1276
1293
definitions,
1294
+ nerfDarts,
1277
1295
} )
1278
1296
1279
1297
await config . load ( )
@@ -1295,6 +1313,7 @@ t.test('workspaces', async (t) => {
1295
1313
cwd : join ( `${ path } /workspaces/one` ) ,
1296
1314
shorthands,
1297
1315
definitions,
1316
+ nerfDarts,
1298
1317
} )
1299
1318
1300
1319
await config . load ( )
@@ -1316,6 +1335,7 @@ t.test('workspaces', async (t) => {
1316
1335
cwd : join ( `${ path } /workspaces/one` ) ,
1317
1336
shorthands,
1318
1337
definitions,
1338
+ nerfDarts,
1319
1339
} )
1320
1340
1321
1341
await config . load ( )
@@ -1337,6 +1357,7 @@ t.test('workspaces', async (t) => {
1337
1357
cwd : join ( `${ path } /workspaces/one` ) ,
1338
1358
shorthands,
1339
1359
definitions,
1360
+ nerfDarts,
1340
1361
excludeNpmCwd : true ,
1341
1362
} )
1342
1363
@@ -1365,6 +1386,7 @@ t.test('workspaces', async (t) => {
1365
1386
cwd : join ( `${ path } /workspaces/one` ) ,
1366
1387
shorthands,
1367
1388
definitions,
1389
+ nerfDarts,
1368
1390
} )
1369
1391
1370
1392
await config . load ( )
@@ -1480,7 +1502,7 @@ t.test('catch project config prefix error', async t => {
1480
1502
} )
1481
1503
const config = new Config ( {
1482
1504
npmPath : `${ path } /npm` ,
1483
- argv : [ process . execPath , __filename , '--projectconfig' , ` ${ path } /project/.npmrc` ] ,
1505
+ argv : [ process . execPath , __filename ] ,
1484
1506
cwd : join ( `${ path } /project` ) ,
1485
1507
shorthands,
1486
1508
definitions,
@@ -1492,7 +1514,7 @@ t.test('catch project config prefix error', async t => {
1492
1514
logs . length = 0
1493
1515
// config.load() triggers the error to be logged
1494
1516
await config . load ( )
1495
- const filtered = logs . filter ( l => l [ 0 ] !== 'silly ')
1517
+ const filtered = logs . filter ( l => l [ 0 ] === 'error ')
1496
1518
t . match ( filtered , [ [
1497
1519
'error' , 'config' , `prefix cannot be changed from project config: ${ path } ` ,
1498
1520
] ] , 'Expected error logged' )
0 commit comments