Skip to content
Merged
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
60 changes: 35 additions & 25 deletions test/docs/documentation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,25 @@ describe('docs/documentation', () => {
.map((match) =>
match.substring(4, match.length - 1).replace(/^`|`$/g, ''),
)
.filter(
(header) =>
header !== 'managerFilePatterns' && header !== 'enabled',
);
.filter((header) => header !== 'managerFilePatterns');
}

function getRequiredConfigOptions(): string[] {
return options
.filter((option) => !option.globalOnly)
.filter((option) => !option.parents)
.filter((option) => !option.autogenerated)
.map((option) => option.name)
.sort();
return (
options
.filter((option) => !option.globalOnly)
// Only include top-level options, which have no parents (implicit root) or explicitly define the
// root ('.') as their parent.
.filter(
(option) =>
!option.parents ||
option.parents.length === 0 ||
option.parents.includes('.'),
)
.filter((option) => !option.autogenerated)
.map((option) => option.name)
.sort()
);
}

it('has doc headers sorted alphabetically', async () => {
Expand All @@ -86,21 +92,25 @@ describe('docs/documentation', () => {
}

function getRequiredConfigSubOptions(): string[] {
return options
.filter((option) => option.stage !== 'global')
.filter((option) => !option.globalOnly)
.filter((option) => option.parents)
.filter(
(option) =>
option.name !== 'managerFilePatterns' &&
option.name !== 'enabled',
)
.flatMap((option) =>
(option.parents ?? [])
.filter((parent) => parent !== '.')
.map((parent) => `${parent}.${option.name}`),
)
.sort();
return (
options
.filter((option) => option.stage !== 'global')
.filter((option) => !option.globalOnly)
// Only include true sub-options: options which have parents but none of those are explicitly the root ('.').
.filter(
(option) =>
option.parents &&
option.parents.length > 0 &&
!option.parents.includes('.'),
)
.filter((option) => option.name !== 'managerFilePatterns')
.flatMap((option) =>
(option.parents ?? [])
.filter((parent) => parent !== '.')
.map((parent) => `${parent}.${option.name}`),
)
.sort()
);
}

function getParentNames(): Set<string> {
Expand Down
Loading