Testy
test/no-focused-tests
No focused tests (.only, fit, fdescribe) are committed; they silently skip the rest of the suite.
poważnastatycznefe-testing
Dlaczego
One .only left in a commit makes the runner execute that test alone and report success. CI turns green while every other test is skipped, so regressions merge unnoticed.
Poprawka
Remove .only, fit and fdescribe before committing. Make CI refuse them: Playwright forbidOnly: !!process.env.CI, Vitest --allowOnly=false (the default in CI), or the lint rules vitest/no-focused-tests, jest/no-focused-tests, mocha/no-exclusive-tests for Cypress.
Przykłady
// bad
it.only('adds an item', () => {})
// good
it('adds an item', () => {})Źródła
Fakty
- Identyfikator
test/no-focused-tests- Waga
- poważna
- Sprawdzanie
- statyczne sprawdzane w kodzie źródłowym przez
audit - Dotyczy plików
jsx- Tylko w projektach z
vitestjestplaywrightcypress- Uczy jej skill
fe-testingFront-end testing- Od wersji
- 0.1.0
Przeczytaj w terminalu
npx github:dawidolko/frontend-skills explain test/no-focused-tests