You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('upgrades package to newest version older than cooldown period',async()=>{
309
+
// Given: test-package@1.0.0 installed, version 1.2.0 released 5 days ago (within cooldown), version 1.1.0 released 15 days ago (outside 10-day cooldown)
310
+
constcooldown=10
311
+
constpackageData: PackageFile={
312
+
dependencies: {
313
+
'test-package': '1.0.0',
314
+
},
315
+
}
316
+
conststub=stubVersions(
317
+
createMockVersion({
318
+
name: 'test-package',
319
+
versions: {
320
+
'1.2.0': newDate(NOW-5*DAY).toISOString(),
321
+
'1.1.0': newDate(NOW-15*DAY).toISOString(),
322
+
},
323
+
}),
324
+
)
325
+
326
+
// When ncu is run with the cooldown parameter and target is 'newest'
it('upgrades package to newest minor version older than cooldown period',async()=>{
338
+
// Given: test-package@1.0.0 installed, version 1.2.0 released 5 days ago (within cooldown), version 1.1.0 released 15 days ago (outside 10-day cooldown)
339
+
constcooldown=10
340
+
constpackageData: PackageFile={
341
+
dependencies: {
342
+
'test-package': '1.0.0',
343
+
},
344
+
}
345
+
conststub=stubVersions(
346
+
createMockVersion({
347
+
name: 'test-package',
348
+
versions: {
349
+
'1.2.0': newDate(NOW-5*DAY).toISOString(),
350
+
'1.1.0': newDate(NOW-15*DAY).toISOString(),
351
+
},
352
+
}),
353
+
)
354
+
355
+
// When ncu is run with the cooldown parameter and target is 'minor'
it('upgrades package to newest patch version older than cooldown period',async()=>{
367
+
// Given: test-package@1.0.0 installed, version 1.0.2 released 5 days ago (within cooldown), version 1.0.1 released 15 days ago (outside 10-day cooldown)
368
+
constcooldown=10
369
+
constpackageData: PackageFile={
370
+
dependencies: {
371
+
'test-package': '1.0.0',
372
+
},
373
+
}
374
+
conststub=stubVersions(
375
+
createMockVersion({
376
+
name: 'test-package',
377
+
versions: {
378
+
'1.0.2': newDate(NOW-5*DAY).toISOString(),
379
+
'1.0.1': newDate(NOW-15*DAY).toISOString(),
380
+
},
381
+
}),
382
+
)
383
+
384
+
// When ncu is run with the cooldown parameter and target is 'patch'
it('upgrades package to newest semver version older than cooldown period',async()=>{
396
+
// Given: test-package@1.0.0 installed, version 1.1.0 released 5 days ago (within cooldown), version 1.0.1 released 15 days ago (outside 10-day cooldown)
397
+
constcooldown=10
398
+
constpackageData: PackageFile={
399
+
dependencies: {
400
+
'test-package': '^1.0.0',
401
+
},
402
+
}
403
+
conststub=stubVersions(
404
+
createMockVersion({
405
+
name: 'test-package',
406
+
versions: {
407
+
'1.1.0': newDate(NOW-5*DAY).toISOString(),
408
+
'1.0.1': newDate(NOW-15*DAY).toISOString(),
409
+
},
410
+
}),
411
+
)
412
+
413
+
// When ncu is run with the cooldown parameter and target is 'semver'
it('skips package upgrade if no time data and cooldown is set',async()=>{
308
423
// Given: cooldown days is set to 10 days, test-package is installed in version 1.0.0, and the latest version - 1.1.0 was released 5 days ago (inside cooldown period). Another version 1.0.1 was released 10 days ago (outside cooldown period), but it is not the latest version, so it should not be upgraded either.
0 commit comments