jest test cases with webpack +react+redux

228 views Asked by At

While running jest test cases, I am getting issue of "can not find module". I have imported app.jsx into my test case file and when i run test case it gives error of "can not find module" inside components imported in app.jsx.

enter image description here

Below is my test case fir 1 ] navbar.test.js -

import React from 'react';
import { shallow, mount, render } from 'enzyme';
var Navbar = require('../javascript/components/layout/app.jsx');

test('Test', () => {
  //Any test
});

2 ] app.jsx -

import React from 'react'
import Navbar from 'layout/navbar'

class App extends React.Component {
   constructor(props) {
           super(props)
       }
   }
   export default app

In test case file ,I am getting issue that 'layout/navbar' not found in app.jsx

3 ] package.json -

"jest": {
     "verbose": true
 }

4 ] babelrc -

{
   "presets": ["es2015", "react"]
}

I have not made any changes in webpack file.

0

There are 0 answers