Skip to content

Latest commit

 

History

History
54 lines (34 loc) · 1.69 KB

File metadata and controls

54 lines (34 loc) · 1.69 KB

CONTRIBUTOR-DOCS / Style guide / Testing guide / Code coverage

Code coverage

In this doc

Coverage is collected by the Storybook Vitest project using the V8 provider.

Coverage thresholds

We enforce per-path thresholds in vitest.config.js:

Path pattern Target What it covers
components/**/*.{ts,js} 100% lines, functions, statements SWC component implementations
**/packages/core/components/**/*.{ts,js} 100% lines, functions, statements Core component base classes
**/packages/core/shared/**/*.{ts,js} 70% lines, functions, statements Shared utilities

Component code and base classes require 100% coverage. Shared utilities have a lower threshold that ratchets upward as coverage improves.

Auto-updating thresholds

The coverage config uses autoUpdate with Math.floor to automatically lock in improvements:

thresholds: {
  autoUpdate: (value) => Math.floor(value),
}

When your tests push coverage above the current threshold, the config file updates itself. This prevents regressions without manual threshold bumps.

Checking coverage

yarn workspace @adobe/swc test:coverage

Review the generated report. If coverage drops below the threshold, add tests to cover the gap before merging.