Skip to content

Commit

Permalink
✅ Add e2e test for creating tags in the right order on init
Browse files Browse the repository at this point in the history
This verifies that the recent change from npm package
semver-compare to compare-versions
solves wrong order of pre-release tags
  • Loading branch information
evilru committed Sep 11, 2024
1 parent fcc6a06 commit 0da7273
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/gitmoji-changelog-cli/src/cli.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,32 @@ describe('generate changelog', () => {

expect(getChangelog()).includes(['1.0.0', '2.0.0'])
})
it('should get three versions 1.0.0 and 1.0.1-alpha.1 and 1.0.1-alpha.2 in the right order while initializing changelog', async () => {
await makeChanges('file1')
await commit(':sparkles: Add some file')
await bumpVersion('1.0.0')
await commit(':bookmark: Version 1.0.0')
await tag('1.0.0')

await makeChanges('file2')
await commit(':sparkles: Add another file')
await bumpVersion('1.0.1-alpha.1')
await commit(':bookmark: Version 1.0.1-alpha.1')
await tag('1.0.1-alpha.1')

await makeChanges('file3')
await commit(':sparkles: Add one more file')
await bumpVersion('1.0.1-alpha.2')
await commit(':bookmark: Version 1.0.1-alpha.2')
await tag('1.0.1-alpha.2')

gitmojiChangelog()

const tags = /name="([^"]+)"/g
const foundTags = [...getChangelog().matchAll(tags)].flatMap(entry => entry[1])

expect([...foundTags]).toEqual(['1.0.1-alpha.2', '1.0.1-alpha.1', '1.0.0'])
})
})

describe('update', () => {
Expand Down

0 comments on commit 0da7273

Please sign in to comment.