Closed
Description
DOM Testing Library
version: Using React Testing Lib Version: ^10.0.0node
version: v12.13.1npm
(oryarn
) version: 6.13.7
Relevant code or config:
await waitFor(() => {
expect(submitButton).toHaveAttribute("aria-disabled", "false");
});
What you did:
I'm using the new React-Testing-Library version and trying to fix my tests that use waitFor
, but it I am getting a MutationObserver error that is preventing my tests from passing.
I'm using the built in CRA react-scripts test command to run my tests
What happened:
TypeError: MutationObserver is not a constructor
146 |
147 | // Wait until the picture is UPLOADED and the disabled attribute is REMOVEaD
> 148 | await waitFor(() => {
| ^
149 | expect(submitButton).toHaveAttribute("aria-disabled", "false");
150 | });
151 |
at node_modules/@testing-library/dom/dist/wait-for.js:32:22
at waitFor (node_modules/@testing-library/dom/dist/wait-for.js:25:10)
at node_modules/@testing-library/dom/dist/wait-for.js:64:54
at node_modules/@testing-library/react/dist/pure.js:51:22
at batchedUpdates$1 (node_modules/react-dom/cjs/react-dom.development.js:21887:12)
at act (node_modules/react-dom/cjs/react-dom-test-utils.development.js:929:14)
at asyncAct (node_modules/@testing-library/react/dist/act-compat.js:118:12)
at Object.asyncWrapper (node_modules/@testing-library/react/dist/pure.js:50:35)
at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:64:35)
at Object.<anonymous> (src/components/NewSpotForm.test.js:148:9)
Metadata
Metadata
Assignees
Labels
No labels