My vitest script failed every time, and CI never ran it
in draw-to-web, package.json had an accessibility script that pointed at a folder nobody had made:
"test:a11y": "vitest run tests/a11y"
there was no tests/a11y/. the axe-core tests lived in tests/templates, tests/seo and tests/export. vitest treats the argument as a filter, finds nothing, and fails:
$ npx vitest run tests/a11y
RUN v1.2.2 ...
filter: tests/a11y
include: **/*.{test,spec}.?(c|m)[jt]s?(x)
...
No test files found, exiting with code 1
$ echo $?
1
so the script could only fail. and CI never ran it: it ran npm test, plain vitest run, and test:a11y wasn’t in the workflow at all. the axe-core suites did run inside npm test, but the one script named for that gate was broken and nobody saw it.
the fix
point the script at the suites that actually run axe-core:
"test:a11y": "vitest run tests/templates tests/seo/axeGate.test.ts tests/export/e2eValidate.test.ts tests/export/exportProject.test.ts"
and give it its own CI step, so an a11y failure shows up as an a11y failure and not as a general test break:
- name: Accessibility gate
run: npm run test:a11y
vitest has --passWithNoTests for the opposite case. it would have turned this script green while it still tested nothing.