bamlab / bamlab/react-native-project-config

userEvent.setup should not be awaited

Open
#148 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
9
Forks
0
Avg merge
10h 29m
Merged PRs (30d)
2

Description

This issue concerns [@bam.tech/await-user-event](https://github.com/bamlab/react-native-project-config/tree/main/packages/eslint-plugin/docs/rules/await-user-event.md)

Image

`setup` is the only function of the `userEvent` object that doesn't return a promise, this should not be awaited.

`userEvent.setup` is called in every test file that uses `userEvent`, outside function blocks. This makes this rule unusable so far.

What can be done:
- detect if the function returns a promise
- explicitly exclude `setup` of this rule

Contributor guide

Open the contributing guide

Research direction

Start with packages/eslint-plugin/docs/rules/await-user-event.md and trace the corresponding rule implementation. Reproduce the warning for userEvent.setup in a test file, then verify the rule no longer flags setup while still checking awaits for the other userEvent functions.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, typescript
Domain
testing, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.