mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
0f1020cb80
JourneyDetailPage.test.tsx has carried 35 describe.skip blocks since April, for contributors, trip linking and the map view, features that were reworked rather than removed. Nothing stops the next skip, and nothing stops a stray .only from passing CI while the rest of its file never runs. lint:skips reads every vitest file under src/ and tests/ and every Playwright spec under e2e/ from its syntax tree. A .only on any runner fails the check, always. Skipped and todo tests (it.skip, describe.skip, test.todo, the x-shorthands, skip.each) are counted per file against scripts/skip-baseline.json, which only lowers. A skip that decides at run time is not a declaration and is not counted: skipIf, runIf, Playwright's test.skip(condition, 'why') and a bare test.skip() inside a test.
24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
/*
|
|
* lint:skips: no test is focused, and skipped tests may only go away.
|
|
*
|
|
* A stray .only passes CI while the rest of its file never runs, so it fails
|
|
* this check wherever it appears. A skipped or todo test is coverage that was
|
|
* switched off and then forgotten (JourneyDetailPage.test.tsx has carried 35
|
|
* skipped blocks since April); the files that hold some are listed in
|
|
* scripts/skip-baseline.json with their count, and a file may hold no more.
|
|
* A skip that decides at run time (skipIf, runIf, Playwright's
|
|
* test.skip(condition, 'why')) is not counted. Covers the vitest tests under
|
|
* src/ and tests/ and the Playwright specs under e2e/.
|
|
*
|
|
* npm run lint:skips check against the baseline (CI)
|
|
* npm run lint:skips -- --update lower the baseline to what the files hold now;
|
|
* it never raises an entry
|
|
*/
|
|
import { fileURLToPath } from 'node:url'
|
|
import { runCli } from './lib/ratchet.mjs'
|
|
import { check } from './lib/skips.mjs'
|
|
|
|
const root = fileURLToPath(new URL('..', import.meta.url))
|
|
await runCli('lint:skips', (args) => check({ root, update: args.includes('--update') }))
|