-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
@testing-library/react
version: 10.0.4react
version: 16.12.0
Relevant code or config:
import { render, screen, fireEvent } from '@testing-library/react'
test('works?', async () => {
render(<App />)
const elem = await screen.findByText('TEST')
fireEvent.click(elem)
})
What you did:
Run the test :)
What happened:
Reproduction:
https://codesandbox.io/s/practical-colden-jbnzf?file=/src/App.test.js
It actually works there, because MutationObserver is available in a browser, but apparently not in jsdom
Problem description:
It's not documented anywhere that MutationObserver would need to be polyfilled. Either way, after doing the following, problem is workaround-ed :)
window.MutationObserver = require("mutation-observer");
Suggested solution:
I think polyfill should be part of the library to remove the hassle of users doing that.
iksarfo, aykutkilic, alexwakeman and strblr
Metadata
Metadata
Assignees
Labels
No labels