diff --git a/src/utils/__tests__/changelog-generate.test.ts b/src/utils/__tests__/changelog-generate.test.ts index 4fbcf760d..3d89474c0 100644 --- a/src/utils/__tests__/changelog-generate.test.ts +++ b/src/utils/__tests__/changelog-generate.test.ts @@ -1320,6 +1320,44 @@ changelog: expect(result.changelog).toContain('feat(ui): single ui feature'); }); + it('does not show Other header when scope grouping is disabled', async () => { + vi.mocked(config.getChangelogConfig).mockReturnValue({ + filePath: 'CHANGELOG.md', + policy: ChangelogPolicy.Auto, + scopeGrouping: false, + includePaths: [], + aiSummary: false, + }); + setup( + [ + { + hash: 'abc123', + title: 'feat(api): api feature 1', + body: '', + pr: { + local: '1', + remote: { number: '1', author: { login: 'alice' } }, + }, + }, + { + hash: 'def456', + title: 'feat(api): api feature 2', + body: '', + pr: { + local: '2', + remote: { number: '2', author: { login: 'bob' } }, + }, + }, + ], + SCOPE_CONFIG, + ); + const result = await generateChangesetFromGit(dummyGit, '1.0.0', 10); + expect(result.changelog).not.toContain('#### Api'); + expect(result.changelog).not.toContain('#### Other'); + expect(result.changelog).toContain('feat(api): api feature 1'); + expect(result.changelog).toContain('feat(api): api feature 2'); + }); + it('does not show Other header when only scopeless entries exist', async () => { setup( [ diff --git a/src/utils/changelog.ts b/src/utils/changelog.ts index 16ec3eae6..da1b1276c 100644 --- a/src/utils/changelog.ts +++ b/src/utils/changelog.ts @@ -1965,9 +1965,11 @@ async function serializeChangelog( }); // Check if any scope has multiple entries (would get its own header) - const hasScopeHeaders = [...category.scopeGroups.entries()].some( - ([s, entries]) => s !== null && entries.length > 1, - ); + const hasScopeHeaders = + scopeGroupingEnabled && + [...category.scopeGroups.entries()].some( + ([s, entries]) => s !== null && entries.length > 1, + ); // Collect entries without headers to combine them into a single section const entriesWithoutHeaders: string[] = [];