@@ -590,6 +590,32 @@ describe('cli', function () {
590
590
var pkgJson = fs . readFileSync ( 'package.json' , 'utf-8' )
591
591
pkgJson . should . equal ( [ '{' , ' "version": "1.1.0"' , '}' , '' ] . join ( '\n' ) )
592
592
} )
593
+
594
+ it ( 'exits with error code if "scripts" is not an object' , ( ) => {
595
+ writePackageJson ( '1.0.0' , {
596
+ 'standard-version' : {
597
+ scripts : 'echo hello'
598
+ }
599
+ } )
600
+
601
+ commit ( 'feat: first commit' )
602
+ var result = execCli ( )
603
+ result . code . should . equal ( 1 )
604
+ result . stderr . should . match ( / s c r i p t s m u s t b e a n o b j e c t / )
605
+ } )
606
+
607
+ it ( 'exits with error code if "skip" is not an object' , ( ) => {
608
+ writePackageJson ( '1.0.0' , {
609
+ 'standard-version' : {
610
+ skip : true
611
+ }
612
+ } )
613
+
614
+ commit ( 'feat: first commit' )
615
+ var result = execCli ( )
616
+ result . code . should . equal ( 1 )
617
+ result . stderr . should . match ( / s k i p m u s t b e a n o b j e c t / )
618
+ } )
593
619
} )
594
620
595
621
describe ( 'standard-version' , function ( ) {
@@ -672,15 +698,14 @@ describe('standard-version', function () {
672
698
writeBowerJson ( '1.0.0' )
673
699
} )
674
700
675
- it ( 'bumps version # in bower.json' , function ( done ) {
701
+ it ( 'bumps version # in bower.json' , function ( ) {
676
702
commit ( 'feat: first commit' )
677
703
shell . exec ( 'git tag -a v1.0.0 -m "my awesome first release"' )
678
704
commit ( 'feat: new feature!' )
679
- require ( './index' ) ( { silent : true } )
705
+ return require ( './index' ) ( { silent : true } )
680
706
. then ( ( ) => {
681
707
JSON . parse ( fs . readFileSync ( 'bower.json' , 'utf-8' ) ) . version . should . equal ( '1.1.0' )
682
708
getPackageVersion ( ) . should . equal ( '1.1.0' )
683
- return done ( )
684
709
} )
685
710
} )
686
711
} )
@@ -706,17 +731,17 @@ describe('standard-version', function () {
706
731
describe ( 'package-lock.json support' , function ( ) {
707
732
beforeEach ( function ( ) {
708
733
writePackageLockJson ( '1.0.0' )
734
+ fs . writeFileSync ( '.gitignore' , '' , 'utf-8' )
709
735
} )
710
736
711
- it ( 'bumps version # in package-lock.json' , function ( done ) {
737
+ it ( 'bumps version # in package-lock.json' , function ( ) {
712
738
commit ( 'feat: first commit' )
713
739
shell . exec ( 'git tag -a v1.0.0 -m "my awesome first release"' )
714
740
commit ( 'feat: new feature!' )
715
- require ( './index' ) ( { silent : true } )
741
+ return require ( './index' ) ( { silent : true } )
716
742
. then ( ( ) => {
717
743
JSON . parse ( fs . readFileSync ( 'package-lock.json' , 'utf-8' ) ) . version . should . equal ( '1.1.0' )
718
744
getPackageVersion ( ) . should . equal ( '1.1.0' )
719
- return done ( )
720
745
} )
721
746
} )
722
747
} )
@@ -765,4 +790,23 @@ describe('standard-version', function () {
765
790
} )
766
791
} )
767
792
} )
793
+
794
+ describe ( '.gitignore' , ( ) => {
795
+ beforeEach ( function ( ) {
796
+ writeBowerJson ( '1.0.0' )
797
+ } )
798
+
799
+ it ( 'does not update files present in .gitignore' , ( ) => {
800
+ fs . writeFileSync ( '.gitignore' , 'bower.json' , 'utf-8' )
801
+
802
+ commit ( 'feat: first commit' )
803
+ shell . exec ( 'git tag -a v1.0.0 -m "my awesome first release"' )
804
+ commit ( 'feat: new feature!' )
805
+ return require ( './index' ) ( { silent : true } )
806
+ . then ( ( ) => {
807
+ JSON . parse ( fs . readFileSync ( 'bower.json' , 'utf-8' ) ) . version . should . equal ( '1.0.0' )
808
+ getPackageVersion ( ) . should . equal ( '1.1.0' )
809
+ } )
810
+ } )
811
+ } )
768
812
} )
0 commit comments