@@ -14,7 +14,11 @@ describe('getNextVersionFromCommitMessages', () => {
14
14
test: abc
15
15
chore: abc` ;
16
16
const bodies = '' ;
17
- const actual = getNextVersionFromCommitMessages ( version , titles , bodies ) ;
17
+ const { version : actual } = getNextVersionFromCommitMessages (
18
+ version ,
19
+ titles ,
20
+ bodies
21
+ ) ;
18
22
expect ( actual ) . toBe ( '1.2.4' ) ;
19
23
} ) ;
20
24
@@ -28,7 +32,11 @@ describe('getNextVersionFromCommitMessages', () => {
28
32
test(abcdef): abc
29
33
chore(abcdefg): abc` ;
30
34
const bodies = '' ;
31
- const actual = getNextVersionFromCommitMessages ( version , titles , bodies ) ;
35
+ const { version : actual } = getNextVersionFromCommitMessages (
36
+ version ,
37
+ titles ,
38
+ bodies
39
+ ) ;
32
40
expect ( actual ) . toBe ( '1.2.4' ) ;
33
41
} ) ;
34
42
@@ -43,7 +51,11 @@ describe('getNextVersionFromCommitMessages', () => {
43
51
chore(abcdefg): abc
44
52
feat(abcdefgh): abc` ;
45
53
const bodies = '' ;
46
- const actual = getNextVersionFromCommitMessages ( version , titles , bodies ) ;
54
+ const { version : actual } = getNextVersionFromCommitMessages (
55
+ version ,
56
+ titles ,
57
+ bodies
58
+ ) ;
47
59
expect ( actual ) . toBe ( '1.3.0' ) ;
48
60
} ) ;
49
61
@@ -58,7 +70,11 @@ describe('getNextVersionFromCommitMessages', () => {
58
70
chore: abc
59
71
feat: abc` ;
60
72
const bodies = '' ;
61
- const actual = getNextVersionFromCommitMessages ( version , titles , bodies ) ;
73
+ const { version : actual } = getNextVersionFromCommitMessages (
74
+ version ,
75
+ titles ,
76
+ bodies
77
+ ) ;
62
78
expect ( actual ) . toBe ( '1.3.0' ) ;
63
79
} ) ;
64
80
@@ -73,25 +89,36 @@ describe('getNextVersionFromCommitMessages', () => {
73
89
chore: abc
74
90
feat: abc` ;
75
91
const bodies = 'BREAKING CHANGE: this breaks the previous behavior.' ;
76
- const actual = getNextVersionFromCommitMessages ( version , titles , bodies ) ;
92
+ const { version : actual } = getNextVersionFromCommitMessages (
93
+ version ,
94
+ titles ,
95
+ bodies
96
+ ) ;
77
97
expect ( actual ) . toBe ( '1.0.0' ) ;
78
98
} ) ;
79
99
80
100
it ( 'gets a null with no commit messages' , ( ) => {
81
101
const version = '0.0.1' ;
82
102
const titles = '' ;
83
103
const bodies = '' ;
84
- const actual = getNextVersionFromCommitMessages ( version , titles , bodies ) ;
104
+ const { version : actual } = getNextVersionFromCommitMessages (
105
+ version ,
106
+ titles ,
107
+ bodies
108
+ ) ;
85
109
expect ( actual ) . toBe ( null ) ;
86
110
} ) ;
87
111
88
112
it ( 'throws when there is a commit message out of convention' , ( ) => {
89
113
const version = '0.0.1' ;
90
114
const titles = `hello: abc` ;
91
115
const bodies = '' ;
92
- expect ( ( ) => {
93
- getNextVersionFromCommitMessages ( version , titles , bodies ) ;
94
- } ) . toThrow ( ) ;
116
+ const { ignoredMessages } = getNextVersionFromCommitMessages (
117
+ version ,
118
+ titles ,
119
+ bodies
120
+ ) ;
121
+ expect ( ignoredMessages ) . toEqual ( [ titles ] ) ;
95
122
} ) ;
96
123
97
124
it ( 'increases version with postfixes' , ( ) => {
@@ -108,7 +135,11 @@ describe('getNextVersionFromCommitMessages', () => {
108
135
chore: abc
109
136
feat: abc` ;
110
137
const bodies = '' ;
111
- const actual = getNextVersionFromCommitMessages ( version , titles , bodies ) ;
138
+ const { version : actual } = getNextVersionFromCommitMessages (
139
+ version ,
140
+ titles ,
141
+ bodies
142
+ ) ;
112
143
expect ( actual ) . toBe ( `0.0.1-${ tag } .124` ) ;
113
144
} ) ;
114
145
} ) ;
@@ -117,32 +148,31 @@ describe('getNextVersionFromCommitMessages', () => {
117
148
describe ( 'getNextVersion' , ( ) => {
118
149
it ( 'gets next version with patch updated' , ( ) => {
119
150
silentExec ( './tests/bootstrap-examples/patch-version-up.sh' ) ;
120
- const actual = getNextVersion ( 'sandbox/patch-version-up' ) ;
151
+ const { version : actual } = getNextVersion ( 'sandbox/patch-version-up' ) ;
121
152
expect ( actual ) . toBe ( '0.0.2' ) ;
122
153
} ) ;
123
154
124
155
it ( 'gets next version with minor updated' , ( ) => {
125
156
silentExec ( './tests/bootstrap-examples/minor-version-up.sh' ) ;
126
- const actual = getNextVersion ( 'sandbox/minor-version-up' ) ;
157
+ const { version : actual } = getNextVersion ( 'sandbox/minor-version-up' ) ;
127
158
expect ( actual ) . toBe ( '0.1.0' ) ;
128
159
} ) ;
129
160
130
161
it ( 'gets next version with major updated' , ( ) => {
131
162
silentExec ( './tests/bootstrap-examples/major-version-up.sh' ) ;
132
- const actual = getNextVersion ( 'sandbox/major-version-up' ) ;
163
+ const { version : actual } = getNextVersion ( 'sandbox/major-version-up' ) ;
133
164
expect ( actual ) . toBe ( '1.0.0' ) ;
134
165
} ) ;
135
166
136
167
it ( 'gets a null with no commit messages' , ( ) => {
137
168
silentExec ( './tests/bootstrap-examples/empty.sh no-commit-log' ) ;
138
- const actual = getNextVersion ( 'sandbox/no-commit-log' ) ;
169
+ const { version : actual } = getNextVersion ( 'sandbox/no-commit-log' ) ;
139
170
expect ( actual ) . toBe ( null ) ;
140
171
} ) ;
141
172
142
173
it ( 'throws when there is a commit message out of convention' , ( ) => {
143
174
silentExec ( './tests/bootstrap-examples/out-of-convention.sh' ) ;
144
- expect ( ( ) => {
145
- getNextVersion ( 'sandbox/out-of-convention' ) ;
146
- } ) . toThrow ( ) ;
175
+ const { ignoredMessages } = getNextVersion ( 'sandbox/out-of-convention' ) ;
176
+ expect ( ignoredMessages ) . toEqual ( [ 'hello: add a' ] ) ;
147
177
} ) ;
148
178
} ) ;
0 commit comments