mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 10:33:59 -05:00
## Summary This PR improves the pre-commit hook performance by: - Using `vitest related` to run only tests affected by changed files - Adding ability to skip expensive tests (filter tests) during pre-commit - Providing a consistent mechanism for skipping expensive tests ## Changes - Modified `lint-staged.config.mjs` to run `vitest related` with `SKIP_EXPENSIVE_TESTS=true` - Updated `test/filter-tests.ts` to use idiomatic `describe.skipIf()` for conditional test execution - Changed `test-min` script to use `SKIP_EXPENSIVE_TESTS` environment variable instead of `--exclude` - Updated `CLAUDE.md` with documentation about the new test workflow ## Impact - Pre-commit hooks are now much faster as they: - Only run tests related to changed files - Skip 688 expensive filter tests - Use the same skipping mechanism as `npm run test-min` ## Testing - ✅ Verified `vitest related` correctly identifies and runs related tests - ✅ Confirmed filter tests are skipped when `SKIP_EXPENSIVE_TESTS=true` - ✅ Tested that full test suite still runs all tests when env var is not set - ✅ Pre-commit hooks work correctly with the new setup 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>
5 lines
180 B
JavaScript
5 lines
180 B
JavaScript
export default {
|
|
'*.ts': ['npm run lint', () => 'npm run ts-check', 'cross-env SKIP_EXPENSIVE_TESTS=true npx vitest related --run'],
|
|
'*.{html,md,js}': ['npm run lint'],
|
|
};
|