Skip to content
← Back to rules

jest/no-test-prefixes 스타일

An auto-fix is available for this rule.

작동 방식

.only.skip을 사용하도록 강제하며, fx는 사용하지 않도록 합니다.

왜 문제가 되는가?

Jest에서는 집중 테스트 및 건너뛴 테스트를 정의하는 방법을 여러 가지로 선택할 수 있습니다:

  • only & skip: it.only, test.only, describe.only, it.skip, test.skip, describe.skip.
  • 'f' & 'x': fit, fdescribe, xit, xtest, xdescribe.

이 규칙은 onlyskip 목록에서 사용되는 방식을 강제합니다.

예시

이 규칙에 맞지 않는 잘못된 코드 예시:

javascript
fit("foo"); // 잘못됨
fdescribe("foo"); // 잘못됨
xit("foo"); // 잘못됨
xtest("foo"); // 잘못됨
xdescribe("foo"); // 잘못됨

이 규칙은 eslint-plugin-vitest와 호환됩니다. 이를 사용하려면 다음 설정을 .oxlintrc.json에 추가하세요:

json
{
  "rules": {
    "vitest/no-test-prefixes": "error"
  }
}

사용 방법

구성 파일 또는 명령줄 인터페이스를 통해 이 규칙을 활성화하려면 다음을 사용할 수 있습니다:

json
{
  "plugins": ["jest"],
  "rules": {
    "jest/no-test-prefixes": "error"
  }
}
bash
oxlint --deny jest/no-test-prefixes --jest-plugin

참고 자료