testing-library / testing-library/user-event
Use consistent test style across codebase
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Description
In https://github.com/testing-library/user-event/pull/558 discussions, we've noticed that the test files across the codebase have a mix of declarative and imperative style.
What happened: When contributing for the first time, I didn't know what style to follow while coding the tests since it's mixed across the codebase and there's tool/docs mention to enforce it
The following code is from __tests__/paste.js
// declarative
test('should paste text in textarea', () => { ... }
// imperative
test('does not paste when readOnly', () => { ... }
Reproduction repository: Go through the tests file of the codebase and see a mixture of declarative and imperative styles.
Problem description: Contributors should know whether style to choose, the current situations may cause a lot of confusion and PR discussions
Suggested solution: Discuss in this issue the following topics:
- What would be the best test style for this codebase: Declarative or Imperative?
- How to enforce a test style?
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
Begin with tests/paste.js and the discussion in pull request #558, then review surrounding test files to compare the two styles. Done means the project has agreed on one style and documented or enforced it for contributors; the issue does not name a specific enforcement file or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- developer-experience, testing
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100