Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow calling configure inside of a test #997

Open
Janpot opened this issue Mar 19, 2025 · 0 comments
Open

Disallow calling configure inside of a test #997

Janpot opened this issue Mar 19, 2025 · 0 comments
Labels
new rule New rule to be included in the plugin

Comments

@Janpot
Copy link

Janpot commented Mar 19, 2025

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

@Janpot Janpot added new rule New rule to be included in the plugin triage Pending to be triaged by a maintainer labels Mar 19, 2025
@Belco90 Belco90 removed the triage Pending to be triaged by a maintainer label Mar 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new rule New rule to be included in the plugin
Projects
None yet
Development

No branches or pull requests

2 participants