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

Warning: The current testing environment is not configured to support act(...)

Open
#1,336 8 comments 9 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

After updating from v15 to v16 of testing-library/react, I'm now getting this error in all of my tests - except the tests still pass just fine.

Warning: The current testing environment is not configured to support act(...)

The error goes away when I downgrade to v15. Since @testing-library/dom is now a peer dep, I tried installing that as well but the error remains.

  • @testing-library/react version: 16
  • Testing Framework and version: vitest, @testing-library/jest
  • DOM Environment: jsdom 23.2.0, and I've tried upgrading this too. no change

With v15, here's what yarn why says (no warnings about act):

yarn why @testing-library/dom
├─ @storybook/testing-library@npm:0.1.0
│  └─ @testing-library/dom@npm:8.20.1 (via npm:^8.3.0)
│
├─ @testing-library/react@npm:15.0.7
│  └─ @testing-library/dom@npm:10.1.0 (via npm:^10.0.0)
│
└─ @testing-library/react@npm:15.0.7 [7cdc2]
   └─ @testing-library/dom@npm:10.1.0 (via npm:^10.0.0)

In 16 with dom added, here's what why says (warnings on act):

├─ @storybook/testing-library@npm:0.1.0
│  └─ @testing-library/dom@npm:8.20.1 (via npm:^8.3.0)
│
└─ tatsu@workspace:.
   └─ @testing-library/dom@npm:10.1.0 (via npm:^10.1.0)

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

Reproduce the warning with @testing-library/react 16 under Vitest, @testing-library/jest, and jsdom 23.2.0, then compare against 15.0.7 and the listed @testing-library/dom dependency trees. No source file or test is named; done means identifying and verifying a fix that removes the warning while keeping tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
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.