|
1 | 1 | import * as crypto from 'crypto'; |
2 | 2 | import * as stream from 'stream'; |
3 | | -import { ConventionalCommit, createScopeVariations, filterCommits, getConventionalCommitsFromGitHistory } from '../lib/conventional-commits'; |
| 3 | +import { ConventionalCommit, filterCommits, getConventionalCommitsFromGitHistory } from '../lib/conventional-commits'; |
4 | 4 | import { ReleaseOptions } from '../lib/types'; |
5 | 5 |
|
6 | 6 | // mock out Git interactions |
@@ -38,6 +38,30 @@ describe('getConventionalCommitsFromGitHistory', () => { |
38 | 38 |
|
39 | 39 | expect(commits).toHaveLength(1); |
40 | 40 | }); |
| 41 | + |
| 42 | + test('Changes to L1 are considered a note group', async () => { |
| 43 | + const commitMessages = [ |
| 44 | + 'fix(ec2): some fix', |
| 45 | + ( |
| 46 | + 'feat: update L1 CloudFormation resource definitions\n\n' + |
| 47 | + 'CHANGES TO L1 RESOURCES:\n' + |
| 48 | + 'L1 resources are automatically generated from...:\n' + |
| 49 | + '- aws-cdk-lib.aws_kendra.CfnDataSource.TemplateConfigurationProperty: template property here has changed from string to json' |
| 50 | + ), |
| 51 | + ]; |
| 52 | + gitRawCommits.mockImplementation(() => mockGitCommits(commitMessages)); |
| 53 | + |
| 54 | + const commits = await getConventionalCommitsFromGitHistory(args, '3.9.2'); |
| 55 | + |
| 56 | + expect(commits[0].notes).toHaveLength(0); |
| 57 | + expect(commits[1].notes).toEqual([{ |
| 58 | + title: 'CHANGES TO L1 RESOURCES', |
| 59 | + text: ( |
| 60 | + 'L1 resources are automatically generated from...:\n' + |
| 61 | + '- aws-cdk-lib.aws_kendra.CfnDataSource.TemplateConfigurationProperty: template property here has changed from string to json' |
| 62 | + ), |
| 63 | + }]); |
| 64 | + }); |
41 | 65 | }); |
42 | 66 |
|
43 | 67 | describe('filterCommits', () => { |
@@ -105,8 +129,19 @@ describe('filterCommits', () => { |
105 | 129 | expect(filteredCommits[0].scope).toEqual('aws-stable'); |
106 | 130 | }); |
107 | 131 |
|
108 | | - test('scope variants take alpha packages into account', () => { |
109 | | - expect(createScopeVariations(['@aws-cdk/aws-batch-alpha'])).toContain('batch'); |
| 132 | + test('alpha packages are not considered stable', () => { |
| 133 | + const ec2Commits = [ |
| 134 | + commitWithScope('aws-ec2-alpha'), |
| 135 | + commitWithScope('ec2'), |
| 136 | + commitWithScope('aws-ec2'), |
| 137 | + ]; |
| 138 | + |
| 139 | + const filteredCommits = filterCommits(ec2Commits, { |
| 140 | + includePackages: ['@aws-cdk/aws-ec2-alpha'], |
| 141 | + }); |
| 142 | + |
| 143 | + expect(filteredCommits.length).toEqual(1); |
| 144 | + expect(filteredCommits[0].scope).toEqual('aws-ec2-alpha'); |
110 | 145 | }); |
111 | 146 | }); |
112 | 147 |
|
|
0 commit comments