Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/utils/__tests__/changelog-generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
8 changes: 5 additions & 3 deletions src/utils/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand Down
Loading