jest/no-test-prefixes 樣式
功能說明
強制使用 .only
和 .skip
取代 f
和 x
。
為何不建議這樣做?
Jest 允許您選擇如何定義聚焦和跳過的測試,每種測試都有多種排列組合
- only & skip:it.only、test.only、describe.only、it.skip、test.skip、describe.skip。
- 'f' & 'x':fit、fdescribe、xit、xtest、xdescribe。
此規則強制使用 only & skip 清單中的用法。
範例
javascript
fit("foo"); // invalid
fdescribe("foo"); // invalid
xit("foo"); // invalid
xtest("foo"); // invalid
xdescribe("foo"); // invalid
此規則與 eslint-plugin-vitest 相容,要使用它,請將以下設定新增至您的 .eslintrc.json
json
{
"rules": {
"vitest/no-test-prefixes": "error"
}
}