@@ -471,14 +471,18 @@ describe('main binary', function () {
471
471
} ) ;
472
472
473
473
describe ( 'RELEASE.md' , function ( ) {
474
- function expectedReleaseContents ( isYarn ) {
474
+ function expectedReleaseContents ( packageManager = 'npm' ) {
475
475
let releaseContents = fs . readFileSync ( path . join ( __dirname , '..' , 'release-template.md' ) , {
476
476
encoding : 'utf8' ,
477
477
} ) ;
478
478
479
- let dependencyInstallReplacementValue = isYarn ? 'yarn install' : 'npm install' ;
479
+ let dependencyInstallReplacementValue = `${ packageManager } install` ;
480
+ let releaseCommandReplacementValue =
481
+ packageManager === 'pnpm' ? 'pnpm exec release-it' : 'npx release-it' ;
480
482
481
- return releaseContents . replace ( '{{INSTALL_DEPENDENCIES}}' , dependencyInstallReplacementValue ) ;
483
+ return releaseContents
484
+ . replace ( '{{INSTALL_DEPENDENCIES}}' , dependencyInstallReplacementValue )
485
+ . replace ( '{{RELEASE_COMMAND}}' , releaseCommandReplacementValue ) ;
482
486
}
483
487
484
488
it ( 'adds RELEASE.md to repo when no yarn.lock exists' , async function ( ) {
@@ -487,7 +491,7 @@ describe('main binary', function () {
487
491
await exec ( [ '--no-install' , '--no-label-updates' ] ) ;
488
492
489
493
expect ( fs . readFileSync ( 'RELEASE.md' , { encoding : 'utf8' } ) ) . toBe (
490
- expectedReleaseContents ( false )
494
+ expectedReleaseContents ( 'npm' )
491
495
) ;
492
496
} ) ;
493
497
@@ -499,7 +503,19 @@ describe('main binary', function () {
499
503
await exec ( [ '--no-install' , '--no-label-updates' ] ) ;
500
504
501
505
expect ( fs . readFileSync ( 'RELEASE.md' , { encoding : 'utf8' } ) ) . toBe (
502
- expectedReleaseContents ( true )
506
+ expectedReleaseContents ( 'yarn' )
507
+ ) ;
508
+ } ) ;
509
+
510
+ it ( 'adds RELEASE.md to repo when pnpm-lock.yaml exists' , async function ( ) {
511
+ fs . writeFileSync ( 'pnpm-lock.yaml' , '' , { encoding : 'utf-8' } ) ;
512
+
513
+ expect ( fs . existsSync ( 'RELEASE.md' ) ) . toBeFalsy ( ) ;
514
+
515
+ await exec ( [ '--no-install' , '--no-label-updates' ] ) ;
516
+
517
+ expect ( fs . readFileSync ( 'RELEASE.md' , { encoding : 'utf8' } ) ) . toBe (
518
+ expectedReleaseContents ( 'pnpm' )
503
519
) ;
504
520
} ) ;
505
521
@@ -515,7 +531,18 @@ describe('main binary', function () {
515
531
await exec ( [ '--no-install' , '--no-label-updates' , '--update' ] ) ;
516
532
517
533
expect ( fs . readFileSync ( 'RELEASE.md' , { encoding : 'utf8' } ) ) . toBe (
518
- expectedReleaseContents ( true )
534
+ expectedReleaseContents ( 'yarn' )
535
+ ) ;
536
+ } ) ;
537
+
538
+ it ( 'updates RELEASE.md when pnpm-lock.yaml exists' , async function ( ) {
539
+ fs . writeFileSync ( 'pnpm-lock.yaml' , '' , { encoding : 'utf-8' } ) ;
540
+ fs . writeFileSync ( 'RELEASE.md' , 'lololol' , 'utf8' ) ;
541
+
542
+ await exec ( [ '--no-install' , '--no-label-updates' , '--update' ] ) ;
543
+
544
+ expect ( fs . readFileSync ( 'RELEASE.md' , { encoding : 'utf8' } ) ) . toBe (
545
+ expectedReleaseContents ( 'pnpm' )
519
546
) ;
520
547
} ) ;
521
548
@@ -525,7 +552,7 @@ describe('main binary', function () {
525
552
await exec ( [ '--no-install' , '--no-label-updates' , '--update' ] ) ;
526
553
527
554
expect ( fs . readFileSync ( 'RELEASE.md' , { encoding : 'utf8' } ) ) . toBe (
528
- expectedReleaseContents ( false )
555
+ expectedReleaseContents ( 'npm' )
529
556
) ;
530
557
} ) ;
531
558
0 commit comments