mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-07-10 17:17:55 +00:00
## Summary Stop running the full Vitest suite twice in unit CI. The critical coverage gate is now a glob-keyed `coverage.thresholds` entry enforced during the single `pnpm test:coverage` run, instead of a second `COVERAGE_CRITICAL=true vitest run --coverage` pass. ## Changes - **What**: All critical directories form one brace-expanded glob key in `coverage.thresholds`; Vitest aggregates the matching files into a single bucket and checks the existing thresholds (69/60/67/70) against it during the normal coverage run. Untested files matching `coverage.include` are counted at 0%, preserving the previous gate's semantics. - **What**: Narrows the litegraph coverage exclusion from a blanket `src/lib/litegraph/**` to the non-critical subfolders, so the critical litegraph folders (`node`, `subgraph`, `utils`) are present in the coverage report the thresholds read. - **What**: Removes the `test:coverage:critical` script, the `COVERAGE_CRITICAL` env branch in `vite.config.mts`, and the separate CI gate step. ## Notes - The normal coverage report now includes the critical litegraph folders, so the Codecov `unit` flag and the coverage Slack baseline will show a one-time shift. - Filtered local runs (`pnpm test:coverage <file>`) fail the gate since most critical files are uncovered; a full `pnpm test:coverage` reproduces CI exactly. Validation: - `pnpm typecheck`, `pnpm exec eslint vite.config.mts`, `pnpm format:check`, `pnpm knip` (pre-push) - Smoke: `pnpm vitest run --coverage src/utils/colorUtil.test.ts` — tests pass, then the gate fails all four metrics against the critical bucket and exits 1, confirming enforcement happens inside the single run - Full-suite gate numbers should be confirmed in CI
58 lines
1.5 KiB
YAML
58 lines
1.5 KiB
YAML
# Description: Unit and component testing with Vitest + coverage reporting
|
|
name: 'CI: Tests Unit'
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master, dev*, core/*, desktop/*]
|
|
pull_request:
|
|
branches-ignore: [wip/*, draft/*, temp/*]
|
|
merge_group:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
should-run: ${{ steps.changes.outputs.should-run }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- id: changes
|
|
uses: ./.github/actions/changes-filter
|
|
|
|
test:
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.should-run == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Setup frontend
|
|
uses: ./.github/actions/setup-frontend
|
|
|
|
- name: Run Vitest tests with coverage
|
|
run: pnpm test:coverage
|
|
|
|
- name: Upload unit coverage artifact
|
|
if: always() && github.event_name == 'push'
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: unit-coverage
|
|
path: coverage/lcov.info
|
|
retention-days: 30
|
|
if-no-files-found: warn
|
|
|
|
- name: Upload coverage to Codecov
|
|
if: always()
|
|
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
|
|
with:
|
|
files: coverage/lcov.info
|
|
flags: unit
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
fail_ci_if_error: false
|