I recently upgraded to jest v28 from v24, installed jest-environment-jsdom and my configuration is "jest": { "testEnvironment": "jsdom", "setupFiles": [ "<rootDir>/setup.js" ] }
I was using done it('test', (done) => { done() })
in many places in the same test file, i am getting the error "Expected done to be called once, but it was called multiple times." when i enable multiple test cases, it works fine with single test case.
Asked
Active
Viewed 1,540 times
0

Niyaz
- 2,677
- 3
- 21
- 40
1 Answers
0
When you use your spy/mock multiple times in different tests, they don't get reset by default after every test.
This answer should help you: https://stackoverflow.com/a/55873465/16068019

leonbubova
- 109
- 1
- 4
-
don't think mocks have anything to do with this – Fraser Steel Jul 11 '23 at 08:26