File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
gitmoji-changelog-cli/src
gitmoji-changelog-markdown/src Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,23 @@ describe('generate changelog', () => {
146146 expect ( getChangelog ( ) ) . includes ( [ '1.0.0' , '2.0.0' ] )
147147 } )
148148
149+ it ( 'should get two versions 1.0.0-alpha.1 and 1.0.0-alpha.2 while updating changelog after tagging a version 1.0.0-alpha.2' , async ( ) => {
150+ await makeChanges ( 'file1' )
151+ await commit ( ':sparkles: Add some file' )
152+ await bumpVersion ( '1.0.0-alpha.1' )
153+ gitmojiChangelog ( )
154+ await commit ( ':bookmark: Version 1.0.0-alpha.1' )
155+ await tag ( '1.0.0-alpha.1' )
156+
157+ await makeChanges ( 'file2' )
158+ await commit ( ':sparkles: Add another file' )
159+ await bumpVersion ( '1.0.0-alpha.2' )
160+ await tag ( '1.0.0-alpha.2' )
161+ gitmojiChangelog ( )
162+
163+ expect ( getChangelog ( ) ) . includes ( [ '1.0.0-alpha.1' , '1.0.0-alpha.2' ] )
164+ } )
165+
149166 it ( "should get two versions 1.0.0 and 2.0.0 while updating changelog by calling cli with 2.0.0 and having package.json's version set to 1.0.0" , async ( ) => {
150167 await makeChanges ( 'file1' )
151168 await commit ( ':sparkles: Add some file' )
Original file line number Diff line number Diff line change @@ -116,18 +116,18 @@ async function getLatestVersion(markdownFile) {
116116 return null
117117 }
118118
119- const versions = markdownContent . match ( / < a n a m e = " ( [ \w . ] + ?) " > < \/ a > / g)
119+ const versions = markdownContent . match ( / < a n a m e = " ( [ \w . - ] + ?) " > < \/ a > / g)
120120
121121 if ( ! versions ) return null
122122
123123 const [ lastVersion , previousVersion ] = versions
124124
125125 const tags = await gitSemverTagsAsync ( )
126- const result = lastVersion . match ( / < a n a m e = " ( [ \w . ] + ?) " > < \/ a > / )
126+ const result = lastVersion . match ( / < a n a m e = " ( [ \w . - ] + ?) " > < \/ a > / )
127127 const isNext = result [ 1 ] === 'next' || ! tags . some ( tag => semver . eq ( tag , result [ 1 ] ) )
128128 if ( ! isNext ) return result [ 1 ]
129129
130- const previousResult = previousVersion . match ( / < a n a m e = " ( [ \w . ] + ?) " > < \/ a > / )
130+ const previousResult = previousVersion . match ( / < a n a m e = " ( [ \w . - ] + ?) " > < \/ a > / )
131131 return previousResult [ 1 ]
132132}
133133
You can’t perform that action at this time.
0 commit comments