1

I have an issue, I have recently upgraded my version of react to use react-script version 5.0.1 from version 4.0.3. Doing the instructions as per https://github.com/facebook/create-react-app/blob/main/CHANGELOG.md

Upon doing this. I can see it had an upgrade for Jest 27. However now it has broken my async/await unit tests, I can see the issue was here: https://github.com/facebook/create-react-app/issues/10747

But it does not detail anywhere, how I can resolve this issue now, I can see it is for the async await tests that use MSW.

Has anyone encountered this or can shed some light on how to resolve?

Example test:

it('Should test data', async () => { render(<App />); 
const text = await screen.findByText('myTitle');
expect(tagText).toBeInTheDocument(); });
Sole
  • 3,100
  • 14
  • 58
  • 112
  • I encountered a similar problem, I can probably help you but I need to know how the test looks and which part is breaking. Are you using also using `userEvent` in your test? – Som Shekhar Mukherjee Apr 30 '22 at 05:44
  • I think it has more to do with the when updating react-scripts to version 5x the scripts updated the version of jest from 26 to 27 which I am sure are breaking changes, As I can see the tests timeout – Sole May 01 '22 at 21:52
  • Test example added – Sole May 01 '22 at 22:15
  • This doesn't help, add at least your `App` component (the component being tested) and the error message. Also, what is `tagText`? I guess you meant `expect(text)`. Best would be if you share a Codesandbox link. – Som Shekhar Mukherjee May 02 '22 at 06:01
  • 1
    Ok, let me create that for you – Sole May 02 '22 at 11:06

0 Answers0