Skip to content

test(atomic-a11y): add comprehensive unit test suite for reporter#7140

Draft
y-lakhdar wants to merge 3 commits intofeat/a11y-reporterfrom
feat/a11y-reporter-unit-tests
Draft

test(atomic-a11y): add comprehensive unit test suite for reporter#7140
y-lakhdar wants to merge 3 commits intofeat/a11y-reporterfrom
feat/a11y-reporter-unit-tests

Conversation

@y-lakhdar
Copy link
Contributor

Summary

Adds 247 unit tests across 12 test files covering the full atomic-a11y reporter pipeline. Split out from #7123 to keep the reporter source PR reviewable.

What's Included

  • 14 new files: 12 test files + shared mock factories + vitest config
  • 3,367 lines of test code (additions only, no source changes)
  • 247 tests across all reporter modules

Test Files

File Tests Module
guards.test.ts 30 Type guard utilities
sorting.test.ts 12 Result sorting logic
shard-resolution.test.ts 28 CI shard detection
criterion-metadata.test.ts 5 WCAG criteria lookup
axe-rule-mappings.test.ts 14 axe-core → WCAG mappings
storybook-extraction.test.ts 31 Component/story name parsing
error-parsing.test.ts 29 axe error → structured result
axe-integration.test.ts 34 End-to-end axe result processing
reporter-utils.test.ts 20 File I/O and package metadata
summary.test.ts 18 Report summary generation
report-builder.test.ts 10 Full report assembly
vitest-a11y-reporter.test.ts 16 Vitest reporter lifecycle
helpers/mock-factories.ts Shared mock factory functions
vitest.config.js Test configuration

Testing Conventions

  • ESM-only imports (.js extensions)
  • .test.ts naming (not .spec.ts)
  • Public interface testing only — no as unknown as private access
  • Mock factories using {...defaults, ...overrides} pattern
  • One behavior per test, descriptive should ... names

How to Run

cd packages/atomic-a11y && pnpm test

Related

Add vitest.config.js and 12 test files covering all testable source modules:
- guards, sorting, shard-resolution, criterion-metadata, axe-rule-mappings
- storybook-extraction, error-parsing, axe-integration, reporter-utils
- summary, report-builder, vitest-a11y-reporter (integration)
- Shared mock factories for test data reuse

247 tests total, all passing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y Accessibility issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant