@@ -14,10 +14,22 @@ var should = require('chai').should()
14
14
15
15
var cliPath = path . resolve ( __dirname , './cli.js' )
16
16
17
+ function branch ( branch ) {
18
+ shell . exec ( 'git branch ' + branch )
19
+ }
20
+
21
+ function checkout ( branch ) {
22
+ shell . exec ( 'git checkout ' + branch )
23
+ }
24
+
17
25
function commit ( msg ) {
18
26
shell . exec ( 'git commit --allow-empty -m"' + msg + '"' )
19
27
}
20
28
29
+ function merge ( msg , branch ) {
30
+ shell . exec ( 'git merge --no-ff -m"' + msg + '" ' + branch )
31
+ }
32
+
21
33
function execCli ( argString ) {
22
34
return shell . exec ( 'node ' + cliPath + ( argString != null ? ' ' + argString : '' ) )
23
35
}
@@ -239,6 +251,25 @@ describe('cli', function () {
239
251
result . code . should . equal ( 0 )
240
252
result . stdout . should . not . match ( / n p m p u b l i s h / )
241
253
} )
254
+
255
+ it ( 'includes merge commits' , function ( ) {
256
+ var branchName = 'new-feature'
257
+ commit ( 'feat: first commit' )
258
+ shell . exec ( 'git tag -a v1.0.0 -m "my awesome first release"' )
259
+ branch ( branchName )
260
+ checkout ( branchName )
261
+ commit ( 'Implementing new feature' )
262
+ checkout ( 'master' )
263
+ merge ( 'feat: new feature from branch' , branchName )
264
+
265
+ execCli ( ) . code . should . equal ( 0 )
266
+
267
+ var content = fs . readFileSync ( 'CHANGELOG.md' , 'utf-8' )
268
+ content . should . match ( / n e w f e a t u r e f r o m b r a n c h / )
269
+
270
+ var pkgJson = fs . readFileSync ( 'package.json' , 'utf-8' )
271
+ pkgJson . should . equal ( [ '{' , ' "version": "1.1.0"' , '}' , '' ] . join ( '\n' ) )
272
+ } )
242
273
} )
243
274
244
275
describe ( 'standard-version' , function ( ) {
0 commit comments