Skip to content

Disallow calling configure inside of a test #997

@Janpot

Description

@Janpot

Name for new rule

prefer-top-level-configure

Description of the new rule

Fail when configure is not called top-level

Testing Library feature

global configuration utility

Testing Library framework(s)

@testing-library/dom, @testing-library/react, perhaps others

What category of rule is this?

Warns about a potential error

Optional: other category of rule

No response

Code examples

import { configure } from '@testing-library/react'
test('some test', () => {
  // FAIL:
  configure({ reactStrictMode: true })

  // ...
})
import { configure } from '@testing-library/react'

// OK:
configure({ reactStrictMode: true })

test('some test', () => {
  // ...
})

Anything else?

No response

Do you want to submit a pull request to make the new rule?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    new ruleNew rule to be included in the plugin

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions