@@ -61,6 +61,7 @@ test('it returns the updated dependency information when there is a yaml fragmen
61
61
expect ( updatedDependencies [ 0 ] . alertState ) . toEqual ( 'DISMISSED' )
62
62
expect ( updatedDependencies [ 0 ] . ghsaId ) . toEqual ( 'GHSA-III-BBB' )
63
63
expect ( updatedDependencies [ 0 ] . cvss ) . toEqual ( 4.6 )
64
+ expect ( updatedDependencies [ 0 ] . dependencyGroup ) . toEqual ( '' )
64
65
} )
65
66
66
67
test ( 'it supports multiple dependencies within a single fragment' , async ( ) => {
@@ -122,6 +123,8 @@ test('it supports multiple dependencies within a single fragment', async () => {
122
123
expect ( updatedDependencies [ 0 ] . alertState ) . toEqual ( 'DISMISSED' )
123
124
expect ( updatedDependencies [ 0 ] . ghsaId ) . toEqual ( 'GHSA-III-BBB' )
124
125
expect ( updatedDependencies [ 0 ] . cvss ) . toEqual ( 4.6 )
126
+ expect ( updatedDependencies [ 0 ] . dependencyGroup ) . toEqual ( '' )
127
+ expect ( updatedDependencies [ 0 ] . dependencyGroup ) . toEqual ( '' )
125
128
126
129
expect ( updatedDependencies [ 1 ] . dependencyName ) . toEqual ( 'coffeescript' )
127
130
expect ( updatedDependencies [ 1 ] . dependencyType ) . toEqual ( 'indirect' )
@@ -135,6 +138,7 @@ test('it supports multiple dependencies within a single fragment', async () => {
135
138
expect ( updatedDependencies [ 1 ] . alertState ) . toEqual ( '' )
136
139
expect ( updatedDependencies [ 1 ] . ghsaId ) . toEqual ( '' )
137
140
expect ( updatedDependencies [ 1 ] . cvss ) . toEqual ( 0 )
141
+ expect ( updatedDependencies [ 1 ] . dependencyGroup ) . toEqual ( '' )
138
142
} )
139
143
140
144
test ( 'it returns the updated dependency information when there is a leading v in the commit message versions' , async ( ) => {
@@ -170,6 +174,50 @@ test('it returns the updated dependency information when there is a leading v in
170
174
expect ( updatedDependencies [ 0 ] . alertState ) . toEqual ( 'DISMISSED' )
171
175
expect ( updatedDependencies [ 0 ] . ghsaId ) . toEqual ( 'GHSA-III-BBB' )
172
176
expect ( updatedDependencies [ 0 ] . cvss ) . toEqual ( 4.6 )
177
+ expect ( updatedDependencies [ 0 ] . dependencyGroup ) . toEqual ( '' )
178
+ } )
179
+
180
+ test ( 'it supports returning information about grouped updates' , async ( ) => {
181
+ const commitMessage =
182
+ 'Bumps the docker group with 3 updates: [github.com/docker/cli](https://github.com/docker/cli), [github.com/docker/docker](https://github.com/docker/docker) and [github.com/moby/moby](https://github.com/moby/moby).\n' +
183
+ '\n' +
184
+ 'Updates `github.com/docker/cli` from 24.0.1+incompatible to 24.0.2+incompatible\n' +
185
+ '- [Commits](docker/cli@v24.0.1...v24.0.2)\n' +
186
+ '\n' +
187
+ 'Updates `github.com/docker/docker` from 24.0.1+incompatible to 24.0.2+incompatible\n' +
188
+ '- [Release notes](https://github.com/docker/docker/releases)\n' +
189
+ '- [Commits](moby/moby@v24.0.1...v24.0.2)\n' +
190
+ '\n' +
191
+ 'Updates `github.com/moby/moby` from 24.0.1+incompatible to 24.0.2+incompatible\n' +
192
+ '- [Release notes](https://github.com/moby/moby/releases)\n' +
193
+ '- [Commits](moby/moby@v24.0.1...v24.0.2)\n' +
194
+ '\n' +
195
+ '---\n' +
196
+ 'updated-dependencies:\n' +
197
+ '- dependency-name: github.com/docker/cli\n' +
198
+ ' dependency-type: direct:production\n' +
199
+ ' update-type: version-update:semver-patch\n' +
200
+ ' dependency-group: docker\n' +
201
+ '- dependency-name: github.com/docker/docker\n' +
202
+ ' dependency-type: direct:production\n' +
203
+ ' update-type: version-update:semver-patch\n' +
204
+ ' dependency-group: docker\n' +
205
+ '- dependency-name: github.com/moby/moby\n' +
206
+ ' dependency-type: direct:production\n' +
207
+ ' update-type: version-update:semver-patch\n' +
208
+ ' dependency-group: docker\n' +
209
+ '...\n' +
210
+ '\n' +
211
+ 'Signed-off-by: dependabot[bot] <support@github.com>\n'
212
+
213
+ const getAlert = async ( ) => Promise . resolve ( { alertState : 'DISMISSED' , ghsaId : 'GHSA-III-BBB' , cvss : 4.6 } )
214
+ const getScore = async ( ) => Promise . resolve ( 43 )
215
+ const updatedDependencies = await updateMetadata . parse ( commitMessage , '' , 'dependabot/docker/gh-base-image/docker-1234566789' , 'main' , getAlert , getScore )
216
+
217
+ expect ( updatedDependencies ) . toHaveLength ( 3 )
218
+
219
+ expect ( updatedDependencies [ 0 ] . dependencyName ) . toEqual ( 'github.com/docker/cli' )
220
+ expect ( updatedDependencies [ 0 ] . dependencyGroup ) . toEqual ( 'docker' )
173
221
} )
174
222
175
223
test ( 'it only returns information within the first fragment if there are multiple yaml documents' , async ( ) => {
@@ -211,6 +259,7 @@ test('it only returns information within the first fragment if there are multipl
211
259
expect ( updatedDependencies [ 0 ] . alertState ) . toEqual ( '' )
212
260
expect ( updatedDependencies [ 0 ] . ghsaId ) . toEqual ( '' )
213
261
expect ( updatedDependencies [ 0 ] . cvss ) . toEqual ( 0 )
262
+ expect ( updatedDependencies [ 0 ] . dependencyGroup ) . toEqual ( '' )
214
263
} )
215
264
216
265
test ( 'it properly handles dependencies which contain slashes' , async ( ) => {
@@ -247,6 +296,7 @@ test('it properly handles dependencies which contain slashes', async () => {
247
296
expect ( updatedDependencies [ 0 ] . alertState ) . toEqual ( '' )
248
297
expect ( updatedDependencies [ 0 ] . ghsaId ) . toEqual ( '' )
249
298
expect ( updatedDependencies [ 0 ] . cvss ) . toEqual ( 0 )
299
+ expect ( updatedDependencies [ 0 ] . dependencyGroup ) . toEqual ( '' )
250
300
} )
251
301
252
302
test ( 'calculateUpdateType should handle all paths' , ( ) => {
0 commit comments