( plugin: Pick<PluginConfig, 'audits' | 'context'>, auditSlug?: string, auditWeight?: number, )
| 77 | * @returns Array of category refs, expanded for each URL in multi-URL configs |
| 78 | */ |
| 79 | export function axeAuditRefs( |
| 80 | plugin: Pick<PluginConfig, 'audits' | 'context'>, |
| 81 | auditSlug?: string, |
| 82 | auditWeight?: number, |
| 83 | ): CategoryRef[] { |
| 84 | const context = validate(pluginUrlContextSchema, plugin.context); |
| 85 | if (auditSlug) { |
| 86 | return expandCategoryRefs( |
| 87 | { |
| 88 | slug: auditSlug, |
| 89 | weight: auditWeight, |
| 90 | type: 'audit', |
| 91 | plugin: AXE_PLUGIN_SLUG, |
| 92 | }, |
| 93 | context, |
| 94 | ); |
| 95 | } |
| 96 | return plugin.audits.flatMap(({ slug }) => |
| 97 | expandCategoryRefs( |
| 98 | { slug, type: 'audit', plugin: AXE_PLUGIN_SLUG }, |
| 99 | context, |
| 100 | ), |
| 101 | ); |
| 102 | } |
| 103 | |
| 104 | function axeGroupSlugs(plugin: Pick<PluginConfig, 'groups'>): AxeGroupSlug[] { |
| 105 | if (!plugin.groups) { |
no test coverage detected