testing-library / testing-library/react-testing-library

asyncWrapper is not executed with act support

Open
#1,302 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
19.7k
Forks
1.2k
Avg merge
3d 16h
Merged PRs (30d)
1

Description

  • @testing-library/react version: 14.2.2
  • Testing Framework and version: jest, 29.7
  • DOM Environment: "jest-environment-jsdom": "29.7.0"
Relevant code or config:
        const {user} = setup(<ControlDate onChange={jest.fn()} />);
        const input = screen.getByRole('textbox');
        await act(async () => {
            await user.type(input, '01.10.2015');
        });
        await act(async () => {
            await user.type(input, '02.12.2012');
        });
What you did:

I'm running events using user-events pacakge - https://github.com/testing-library/user-event

What happened:

Looks like it is executed in AsyncWrapper and make a lot of noise about "non-act environment".
https://github.com/testing-library/user-event/discussions/1200

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided user-event example with Jest, jsdom, and @testing-library/react 14.2.2, then inspect the AsyncWrapper and act integration discussed in user-event discussion 1200. Clarify the expected behavior before changing anything; done should mean the supported act usage no longer produces the reported non-act-environment warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.