@@ -398,6 +398,100 @@ test('it handles branch names with hyphen separator and multiple dependencies',
398
398
expect ( updatedDependencies [ 0 ] . directory ) . toEqual ( '/' )
399
399
} )
400
400
401
+ test ( 'it handles branch names when it has dependency-group and non-root directory' , async ( ) => {
402
+ const commitMessage = `Bumps the eslint group in /first-package with 1 update: [eslint](https://github.com/eslint/eslint).
403
+
404
+
405
+ Updates \`eslint\` from 9.12.0 to 9.13.0
406
+ - [Release notes](https://github.com/eslint/eslint/releases)
407
+ - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
408
+ - [Commits](eslint/[email protected] )
409
+
410
+ ---
411
+ updated-dependencies:
412
+ - dependency-name: eslint
413
+ dependency-type: direct:development
414
+ update-type: version-update:semver-minor
415
+ dependency-group: eslint
416
+ ...
417
+
418
+ Signed-off-by: dependabot[bot] <[email protected] >`
419
+
420
+ const getAlert = async ( ) => Promise . resolve ( { alertState : 'DISMISSED' , ghsaId : 'GHSA-III-BBB' , cvss : 4.6 } )
421
+ const getScore = async ( ) => Promise . resolve ( 43 )
422
+ const updatedDependencies = await updateMetadata . parse ( commitMessage , '' , 'dependabot/npm_and_yarn/first-package/eslint-3c401b8a51' , 'main' , getAlert , getScore )
423
+
424
+ expect ( updatedDependencies [ 0 ] . directory ) . toEqual ( '/first-package' )
425
+ } )
426
+
427
+ test ( 'it handles branch names when it has dependency-group and root directory' , async ( ) => {
428
+ const commitMessage = `Bumps the eslint group in /first-package with 1 update: [eslint](https://github.com/eslint/eslint).
429
+
430
+
431
+ Updates \`eslint\` from 9.12.0 to 9.13.0
432
+ - [Release notes](https://github.com/eslint/eslint/releases)
433
+ - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
434
+ - [Commits](eslint/[email protected] )
435
+
436
+ ---
437
+ updated-dependencies:
438
+ - dependency-name: eslint
439
+ dependency-type: direct:development
440
+ update-type: version-update:semver-minor
441
+ dependency-group: eslint
442
+ ...
443
+
444
+ Signed-off-by: dependabot[bot] <[email protected] >`
445
+
446
+ const getAlert = async ( ) => Promise . resolve ( { alertState : 'DISMISSED' , ghsaId : 'GHSA-III-BBB' , cvss : 4.6 } )
447
+ const getScore = async ( ) => Promise . resolve ( 43 )
448
+ const updatedDependencies = await updateMetadata . parse ( commitMessage , '' , 'dependabot/npm_and_yarn/first-package/eslint-3c401b8a51' , 'main' , getAlert , getScore )
449
+
450
+ expect ( updatedDependencies [ 0 ] . directory ) . toEqual ( '/first-package' )
451
+ } )
452
+
453
+ test ( 'it handles branch names when it has dependency-group with multiple dependencies and non-root directory' , async ( ) => {
454
+ const commitMessage = `Bumps the grouped-dependencies group with 3 updates in the /first-package directory: [eslint](https://github.com/eslint/eslint), [rimraf](https://github.com/isaacs/rimraf) and [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest).
455
+
456
+
457
+ Updates \`eslint\` from 9.12.0 to 9.13.0
458
+ - [Release notes](https://github.com/eslint/eslint/releases)
459
+ - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
460
+ - [Commits](eslint/[email protected] )
461
+
462
+ Updates \`rimraf\` from 5.0.10 to 6.0.1
463
+ - [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md)
464
+ - [Commits](isaacs/[email protected] )
465
+
466
+ Updates \`vitest\` from 1.6.0 to 2.1.3
467
+ - [Release notes](https://github.com/vitest-dev/vitest/releases)
468
+ - [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.3/packages/vitest)
469
+
470
+ ---
471
+ updated-dependencies:
472
+ - dependency-name: eslint
473
+ dependency-type: direct:development
474
+ update-type: version-update:semver-minor
475
+ dependency-group: grouped-dependencies
476
+ - dependency-name: rimraf
477
+ dependency-type: direct:development
478
+ update-type: version-update:semver-major
479
+ dependency-group: grouped-dependencies
480
+ - dependency-name: vitest
481
+ dependency-type: direct:development
482
+ update-type: version-update:semver-major
483
+ dependency-group: grouped-dependencies
484
+ ...
485
+
486
+ Signed-off-by: dependabot[bot] <[email protected] >`
487
+
488
+ const getAlert = async ( ) => Promise . resolve ( { alertState : 'DISMISSED' , ghsaId : 'GHSA-III-BBB' , cvss : 4.6 } )
489
+ const getScore = async ( ) => Promise . resolve ( 43 )
490
+ const updatedDependencies = await updateMetadata . parse ( commitMessage , '' , 'dependabot/npm_and_yarn/first-package/grouped-dependencies-b23a7a6750' , 'main' , getAlert , getScore )
491
+
492
+ expect ( updatedDependencies [ 0 ] . directory ) . toEqual ( '/first-package' )
493
+ } )
494
+
401
495
test ( 'calculateUpdateType should handle all paths' , ( ) => {
402
496
expect ( updateMetadata . calculateUpdateType ( '' , '' ) ) . toEqual ( '' )
403
497
expect ( updateMetadata . calculateUpdateType ( '' , '1' ) ) . toEqual ( '' )
0 commit comments