@@ -66,7 +66,7 @@ function mock ({ bump, changelog, tags }) {
66
66
}
67
67
} ) )
68
68
69
- mockery . registerMock ( 'git-semver-tags' , function ( cb ) {
69
+ mockery . registerMock ( 'git-semver-tags' , function ( _ , cb ) {
70
70
if ( tags instanceof Error ) cb ( tags )
71
71
else cb ( null , tags || [ ] )
72
72
} )
@@ -103,6 +103,29 @@ describe('git', function () {
103
103
}
104
104
} )
105
105
106
+ describe ( 'tagPrefix' , ( ) => {
107
+ // TODO: Use unmocked git-semver-tags and stage a git environment
108
+ it ( 'will add prefix onto tag based on version from package' , async function ( ) {
109
+ writePackageJson ( '1.2.0' )
110
+ mock ( { bump : 'minor' , tags : [ 'p-v1.2.0' ] } )
111
+ await exec ( '--tag-prefix p-v' )
112
+ shell . exec ( 'git tag' ) . stdout . should . match ( / p - v 1 \. 3 \. 0 / )
113
+ } )
114
+
115
+ it ( 'will add prefix onto tag via when gitTagFallback is true and no package [cli]' , async function ( ) {
116
+ shell . rm ( 'package.json' )
117
+ mock ( { bump : 'minor' , tags : [ 'android/production/v1.2.0' , 'android/production/v1.0.0' ] } )
118
+ await exec ( '--tag-prefix android/production/v' )
119
+ shell . exec ( 'git tag' ) . stdout . should . match ( / a n d r o i d \/ p r o d u c t i o n \/ v 1 \. 3 \. 0 / )
120
+ } )
121
+
122
+ it ( 'will add prefix onto tag via when gitTagFallback is true and no package [options]' , async function ( ) {
123
+ mock ( { bump : 'minor' , tags : [ 'android/production/v1.2.0' , 'android/production/v1.0.0' ] } )
124
+ await exec ( { tagPrefix : 'android/production/v' , packageFiles : [ ] } )
125
+ shell . exec ( 'git tag' ) . stdout . should . match ( / a n d r o i d \/ p r o d u c t i o n \/ v 1 \. 3 \. 0 / )
126
+ } )
127
+ } )
128
+
106
129
it ( 'formats the commit and tag messages appropriately' , async function ( ) {
107
130
mock ( { bump : 'minor' , tags : [ 'v1.0.0' ] } )
108
131
await exec ( { } )
0 commit comments