I am trying to setup jest test following https://jestjs.io/docs/en/tutorial-react I have installed the jest related dependencies, created __test__/link.react.test.js and Link.react.js. Following is my structure:

However, it has problem for the test as following. But My structure and two files are exactly same as the tutorial.
FAIL __tests__/link.react.test.js
● Test suite failed to run
Cannot find module '../Link.react' from 'Link.react.js'
5 |
6 | import React from 'react';
> 7 | import Link from '../Link.react';
| ^
8 | import renderer from 'react-test-renderer';
9 |
10 | it('renders correctly', () => {
Change file name from Link.react.js to Link.js. And change in the link.react.test.js file the path to Link. Sorry, I don't know exactly why it will work :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With