Cannot find module './Navbar' from 'src/components/Navbar/NavBar.test.js'
Steps to reproduce the bug
run npm run test -- --coverage .
Resulting and expected behaviour
All tests should pass
Information
Summary of all failing tests
FAIL src/components/Navbar/NavBar.test.js
● Test suite failed to run
Cannot find module './Navbar' from 'src/components/Navbar/NavBar.test.js'
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
> 3 | import Navbar from './Navbar';
| ^
4 | import { render } from '@testing-library/react';
5 | import '@testing-library/jest-dom/extend-expect';
6 |
at Resolver.resolveModule (node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:306:11)
at Object.<anonymous> (src/components/Navbar/NavBar.test.js:3:1)
Proposed solution
Use correct NavBar
spelling:
import Navbar from './Navbar';
-> import Navbar from './NavBar';