33const { check, files, mocks, bump } = require ( "../utils" ) ;
44const { expect } = require ( "chai" ) ;
55
6- describe . skip ( "bump --tag" , ( ) => {
6+ describe ( "bump --tag" , ( ) => {
7+
8+ it ( "should not tag by default" , ( ) => {
9+ files . create ( "package.json" , { version : "1.0.0" } ) ;
10+
11+ let cli = bump ( "major" ) ;
12+
13+ expect ( cli ) . to . have . stderr ( "" ) ;
14+ expect ( cli ) . to . have . exitCode ( 0 ) ;
15+
16+ expect ( cli ) . to . have . stdout (
17+ `${ check } Updated package.json to 2.0.0\n`
18+ ) ;
19+
20+ let git = mocks . git ( ) ;
21+ expect ( git . length ) . to . equal ( 0 ) ;
22+ } ) ;
23+
24+ it ( "should not tag by default, even if --commit is used" , ( ) => {
25+ files . create ( "package.json" , { version : "1.0.0" } ) ;
26+
27+ let cli = bump ( "major --commit" ) ;
28+
29+ expect ( cli ) . to . have . stderr ( "" ) ;
30+ expect ( cli ) . to . have . exitCode ( 0 ) ;
31+
32+ expect ( cli ) . to . have . stdout (
33+ `${ check } Updated package.json to 2.0.0\n` +
34+ `${ check } Git commit\n`
35+ ) ;
36+
37+ let git = mocks . git ( ) ;
38+ expect ( git . length ) . to . equal ( 1 ) ;
39+ expect ( git [ 0 ] ) . to . equal ( 'git commit --message "release v2.0.0" package.json' ) ;
40+ } ) ;
741
842 it ( "should add a git tag" , ( ) => {
943 files . create ( "package.json" , { version : "1.0.0" } ) ;
1044
11- let cli = bump ( "-- major --commit --tag" ) ;
45+ let cli = bump ( "major --commit --tag" ) ;
1246
1347 expect ( cli ) . to . have . stderr ( "" ) ;
1448 expect ( cli ) . to . have . exitCode ( 0 ) ;
@@ -22,14 +56,14 @@ describe.skip("bump --tag", () => {
2256 let git = mocks . git ( ) ;
2357 expect ( git . length ) . to . equal ( 2 ) ;
2458
25- expect ( git [ 0 ] . cmd ) . to . equal ( 'git commit package.json -m "release v2.0.0"' ) ;
26- expect ( git [ 1 ] . cmd ) . to . equal ( " git tag -a v2.0.0 -m 2 .0.0" ) ;
59+ expect ( git [ 0 ] ) . to . equal ( 'git commit --message "release v2.0.0" package.json ' ) ;
60+ expect ( git [ 1 ] ) . to . equal ( ' git tag --annotate --message "release v2.0.0" v2 .0.0' ) ;
2761 } ) ;
2862
2963 it ( "should add a git tag, even if --commit is not specified" , ( ) => {
3064 files . create ( "package.json" , { version : "1.0.0" } ) ;
3165
32- let cli = bump ( "-- minor --tag" ) ;
66+ let cli = bump ( "minor --tag" ) ;
3367
3468 expect ( cli ) . to . have . stderr ( "" ) ;
3569 expect ( cli ) . to . have . exitCode ( 0 ) ;
@@ -43,14 +77,14 @@ describe.skip("bump --tag", () => {
4377 let git = mocks . git ( ) ;
4478 expect ( git . length ) . to . equal ( 2 ) ;
4579
46- expect ( git [ 0 ] . cmd ) . to . equal ( 'git commit package.json -m "release v1.1.0"' ) ;
47- expect ( git [ 1 ] . cmd ) . to . equal ( " git tag -a v1.1.0 -m 1 .1.0" ) ;
80+ expect ( git [ 0 ] ) . to . equal ( 'git commit --message "release v1.1.0" package.json ' ) ;
81+ expect ( git [ 1 ] ) . to . equal ( ' git tag --annotate --message "release v1.1.0" v1 .1.0' ) ;
4882 } ) ;
4983
5084 it ( "should tag all files" , ( ) => {
5185 files . create ( "package.json" , { version : "1.0.0" } ) ;
5286
53- let cli = bump ( "-- patch --tag --all" ) ;
87+ let cli = bump ( "patch --tag --all" ) ;
5488
5589 expect ( cli ) . to . have . stderr ( "" ) ;
5690 expect ( cli ) . to . have . exitCode ( 0 ) ;
@@ -64,22 +98,22 @@ describe.skip("bump --tag", () => {
6498 let git = mocks . git ( ) ;
6599 expect ( git . length ) . to . equal ( 2 ) ;
66100
67- expect ( git [ 0 ] . cmd ) . to . equal ( 'git commit -a -m "release v1.0.1"' ) ;
68- expect ( git [ 1 ] . cmd ) . to . equal ( " git tag -a v1.0.1 -m 1 .0.1" ) ;
101+ expect ( git [ 0 ] ) . to . equal ( 'git commit --all --message "release v1.0.1"' ) ;
102+ expect ( git [ 1 ] ) . to . equal ( ' git tag --annotate --message "release v1.0.1" v1 .0.1' ) ;
69103 } ) ;
70104
71105 it ( "should push git tags" , ( ) => {
72106 files . create ( "package.json" , { version : "1.0.0" } ) ;
73107 files . create ( "bower.json" , { version : "1.0.0" } ) ;
74108
75- let cli = bump ( "-- premajor --tag --push" ) ;
109+ let cli = bump ( "premajor --tag --push *.json " ) ;
76110
77111 expect ( cli ) . to . have . stderr ( "" ) ;
78112 expect ( cli ) . to . have . exitCode ( 0 ) ;
79113
80114 expect ( cli ) . to . have . stdout (
81- `${ check } Updated package .json to 2.0.0-beta.0 \n` +
82- `${ check } Updated bower .json to 2.0.0-beta.0 \n` +
115+ `${ check } Updated bower .json to 2.0.0-beta.1 \n` +
116+ `${ check } Updated package .json to 2.0.0-beta.1 \n` +
83117 `${ check } Git commit\n` +
84118 `${ check } Git tag\n` +
85119 `${ check } Git push\n`
@@ -88,9 +122,9 @@ describe.skip("bump --tag", () => {
88122 let git = mocks . git ( ) ;
89123 expect ( git . length ) . to . equal ( 4 ) ;
90124
91- expect ( git [ 0 ] . cmd ) . to . equal ( 'git commit package.json bower.json -m "release v2.0.0-beta.0" ' ) ;
92- expect ( git [ 1 ] . cmd ) . to . equal ( " git tag -a v2.0.0-beta.0 -m 2 .0.0-beta.0" ) ;
93- expect ( git [ 2 ] . cmd ) . to . equal ( "git push" ) ;
94- expect ( git [ 3 ] . cmd ) . to . equal ( "git push --tags" ) ;
125+ expect ( git [ 0 ] ) . to . equal ( 'git commit --message "release v2.0.0-beta.1" bower.json package.json ' ) ;
126+ expect ( git [ 1 ] ) . to . equal ( ' git tag --annotate --message "release v2.0.0-beta.1" v2 .0.0-beta.1' ) ;
127+ expect ( git [ 2 ] ) . to . equal ( "git push" ) ;
128+ expect ( git [ 3 ] ) . to . equal ( "git push --tags" ) ;
95129 } ) ;
96130} ) ;
0 commit comments