コンテンツにスキップ

useConsistentTestIt

このコンテンツはまだ日本語訳がありません。

biome.json
{
"linter": {
"rules": {
"nursery": {
"useConsistentTestIt": "error"
}
}
}
}

Enforce consistent use of it or test for test functions.

it and test are aliases for the same function in most test frameworks. This rule enforces using one over the other for consistency.

test("foo", () => {});
code-block.js:1:1 lint/nursery/useConsistentTestIt  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Prefer using it over test for test functions.

> 1 │ test(“foo”, () => {});
^^^^
2 │

Use it consistently for all test function calls.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Safe fix: Use it instead.

1 - test(foo,·()·=>·{});
1+ it(foo,·()·=>·{});
2 2

it("foo", () => {});

The function to use for top-level tests (outside describe blocks). Accepted values are:

  • "it" (default): Enforce using it() for top-level tests
  • "test": Enforce using test() for top-level tests
biome.json
{
"linter": {
"rules": {
"nursery": {
"useConsistentTestIt": {
"options": {
"function": "test"
}
}
}
}
}
}
it("foo", () => {});
code-block.js:1:1 lint/nursery/useConsistentTestIt  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Prefer using test over it for test functions.

> 1 │ it(“foo”, () => {});
^^
2 │

Use test consistently for all test function calls.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Safe fix: Use test instead.

1 - it(foo,·()·=>·{});
1+ test(foo,·()·=>·{});
2 2

test("foo", () => {});

The function to use for tests inside describe blocks. Accepted values are:

  • "it" (default): Enforce using it() inside describe blocks
  • "test": Enforce using test() inside describe blocks
biome.json
{
"linter": {
"rules": {
"nursery": {
"useConsistentTestIt": {
"options": {
"withinDescribe": "test"
}
}
}
}
}
}
describe("suite", () => {
it("foo", () => {});
});
code-block.js:2:5 lint/nursery/useConsistentTestIt  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Prefer using test over it for test functions.

1 │ describe(“suite”, () => {
> 2 │ it(“foo”, () => {});
^^
3 │ });
4 │

Use test consistently for all test function calls.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Safe fix: Use test instead.

1 1 describe(“suite”, () => {
2 - ····it(foo,·()·=>·{});
2+ ····test(foo,·()·=>·{});
3 3 });
4 4

describe("suite", () => {
test("foo", () => {});
});