testing-library / testing-library/eslint-plugin-testing-library
Disallow calling `configure` inside of a test
Open
Nobody has claimed this yet.
good first issue
new rule
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 168
- Avg merge
- 15h 44m
- Merged PRs (30d)
- 14
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the requested prefer-top-level-configure rule and the Testing Library global configuration utility, comparing the failing and OK examples for @testing-library/dom and @testing-library/react. Done means calls to configure inside a test are reported while top-level calls are accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, react, typescript
- Domain
- testing-qa, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100