noDuplicateTestHooks
Este conteúdo não está disponível em sua língua ainda.
Diagnostic Category: lint/suspicious/noDuplicateTestHooks
Since: v1.6.0
Sources:
- Inspired from:
jest/no-duplicate-hooks
A describe
block should not contain duplicate hooks.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-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.