Currently trying some testing using Jest for the first time on a create-react-app project:
import { render, cleanup } from "@testing-library/react";
import React from "react";
import CarouselItem from "./carousel-item.component";
afterEach(cleanup);
describe("<carousel-item.test />", () => {
const defaultProps = {};
const element = render(<CarouselItem {...defaultProps} />);
test("render", () => {
expect(element).toMatchSnapshot();
});
});
But I've been receiving this error when running the test:
ReferenceError: regeneratorRuntime is not defined
40 | }, [$title, genreIDs]);
41 |
> 42 | const getInfo = async (id) => {
| ^
43 | // get additional title data
44 | try {
I have seen a few different answers but none of them pertain specifically to create-react-app projects so I wanted to double check.
Should I just install regenerator-runtime and import it into every file using an async function? The CRA docs and other answers I've seen give the impression that this sort of thing should be polyfilled automatically when using CRA, am I doing something wrong?
TIA