Closed
Description
I have a test like
import React from "react";
import { render, screen } from "@testing-library/react";
import Countdown from "./Countdown";
describe('Countdown', () => {
test("renders Countdown without crashing", async () => {
const { container, getByText } = render(<Countdown timeTillDate="07 08 2020, 6:00 am" timeFormat="MM DD YYYY, h:mm a" />);
await screen.findByText('Countdown');
// render should show the title
expect(getByText(/Countdown/)).toBeInTheDocument();
expect(container).toContainElement(document.querySelector('h1'));
});
});
This test fails with an exception
TypeError: MutationObserver is not a constructor
This same issue was raised and closed because a polyfill solved the problem. But it was also mentioned that with the latest code a polyfill was not needed. The web application that I am using was originally started with Create-React-App. Here is a snippet of my package.json to get an idea of the versions I am using:
"@testing-library/dom": "^7.20.0",
"@testing-library/jest-dom": "^5.11.0",
"@testing-library/react": "^10.4.3",
"@testing-library/user-event": "^12.0.11",
...
"cross-env": "6.0.3",
...
"ts-jest": "^26.1.1",
"typescript": "3.9.6"
With these versions I shouldn't need a polyfill right?
Thank you.
Metadata
Metadata
Assignees
Labels
No labels