Files
ComfyUI_frontend/browser_tests/coverageConfig.ts
Christian Byrne 0efc0c4d72 test: exclude legacy UI component library from e2e coverage (#11377)
*PR Created by the Glary-Bot Agent*

---

## Summary

- Excludes `src/scripts/ui/**` (legacy DOM component library) from
Playwright e2e coverage reports — this code is kept solely for extension
backwards-compatibility and shouldn't count toward coverage metrics
- Extracts Monocart coverage config (`outputDir`, `sourceFilter`) into
`browser_tests/coverageConfig.ts` so coverage exclusions are
discoverable and centralized instead of buried in `globalTeardown.ts`

## Details

Monocart does support external config files (`mcr.config.ts`
auto-discovery), but since MCR is instantiated in two places with
different configs (per-worker collection in `ComfyPage.ts` vs final
report in `globalTeardown.ts`), auto-discovery would affect both
instances. A shared TypeScript constant is safer and more explicit.

## Changes
- **New**: `browser_tests/coverageConfig.ts` — shared
`COVERAGE_OUTPUT_DIR` and `coverageSourceFilter`
- **Modified**: `browser_tests/globalTeardown.ts` — imports from shared
config
- **Modified**: `browser_tests/fixtures/ComfyPage.ts` — imports
`COVERAGE_OUTPUT_DIR`

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-11377-test-exclude-legacy-UI-component-library-from-e2e-coverage-3466d73d365081b78dc9e4e14d913295)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com>
2026-04-22 19:46:34 -07:00

19 lines
672 B
TypeScript

export const COVERAGE_OUTPUT_DIR = './coverage/playwright'
/**
* Controls which source files are included in E2E coverage reports.
* Matched against the full file path of each covered source.
*
* - Patterns are evaluated in order; the first match wins.
* - `false` excludes; `true` includes.
* - The catch-all entry at the end includes everything not excluded above.
*/
export const coverageSourceFilter: Readonly<Record<string, boolean>> = {
'**/node_modules/**': false,
'**/browser_tests/**': false,
// Legacy DOM component library kept only for extension backwards-compat
'**/src/scripts/ui.ts': false,
'**/src/scripts/ui/**': false,
'**/*': true
}