noDuplicateTestHooks
诊断类别:lint/suspicious/noDuplicateTestHooks
¥Diagnostic Category: lint/suspicious/noDuplicateTestHooks
自从:v1.6.0
¥Since: v1.6.0
来源:
¥Sources:
-
¥Inspired from:
jest/no-duplicate-hooks
describe
块不应包含重复的钩子。
¥A describe
block should not contain duplicate hooks.
¥Examples
¥Invalid
code-block.js:5:3 lint/suspicious/noDuplicateTestHooks ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Disallow duplicate setup and teardown hooks.
3 │ // some setup
4 │ });
> 5 │ beforeEach(() => {
│ ^^^^^^^^^^^^^^^^^^
> 6 │ // some setup
> 7 │ });
│ ^^
8 │ test(‘foo_test’, () => {
9 │ // some test
ℹ Disallow beforeEach duplicacy inside the describe function.
code-block.js:9:4 lint/suspicious/noDuplicateTestHooks ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Disallow duplicate setup and teardown hooks.
7 │ // some teardown
8 │ });
> 9 │ afterAll(() => {
│ ^^^^^^^^^^^^^^^^
> 10 │ // some teardown
> 11 │ });
│ ^^
12 │ });
13 │ });
ℹ Disallow afterAll duplicacy inside the describe function.
¥Valid
¥Related links