Mastering Development

How to setup jest with node_modules that use es6

I have a very simple test: describe(‘sanity’, () => { it(‘sanity’, () => { expect(true).toBeTruthy() }) }) And I’m receiving the following error: FAIL spec/javascript/sanity_test.js ● Test suite failed to run Jest encountered an unexpected token This usually means that you are trying to import a file which Jest cannot parse, e.g. it’s not plain […]


Jest & React & Typescript & React-Testing-Library error

I have a React/NextJS project setup using Typescript and am adding unit testing with Jest and React Testing Library. A unit test for my component looks like this: import React from ‘react’; import ‘@testing-library/jest-dom/extend-expect’; import { render } from ‘@testing-library/react’; import AppLayout from ‘.’; describe(‘<AppLayout>’, () => { it(‘renders children’, () => { const children […]