Skip to content

Commit 827be4d

Browse files
committed
fix(plugin-lighthouse): generate categories for single URL
1 parent 4d426e2 commit 827be4d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/plugin-lighthouse/src/lib/merge-categories.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ function createCategories(
4949
groups: Group[],
5050
context: PluginUrlContext,
5151
): CategoryConfig[] {
52-
if (!shouldExpandForUrls(context.urlCount)) {
53-
return [];
54-
}
5552
return extractGroupSlugs(groups).map(slug =>
5653
createAggregatedCategory(slug, context),
5754
);

packages/plugin-lighthouse/src/lib/merge-categories.unit.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,17 @@ describe('mergeLighthouseCategories', () => {
9898
},
9999
};
100100

101-
it('should return empty array when no categories provided', () => {
102-
expect(mergeLighthouseCategories(plugin)).toEqual([]);
101+
it('should create categories from groups when no categories provided', () => {
102+
expect(mergeLighthouseCategories(plugin)).toEqual([
103+
expect.objectContaining({
104+
slug: 'performance',
105+
refs: [expect.objectContaining({ slug: 'performance', weight: 1 })],
106+
}),
107+
expect.objectContaining({
108+
slug: 'accessibility',
109+
refs: [expect.objectContaining({ slug: 'accessibility', weight: 1 })],
110+
}),
111+
]);
103112
});
104113

105114
it('should return provided categories unchanged', () => {

0 commit comments

Comments
 (0)