Setting up the Jest test ("App-test.js") for the Redux action ("App.js") in the app/__tests__ :
Here is the App.js header:
jest.unmock('../../modules/actions/App.js') import React from 'react' import ReactDOM from 'react-dom' import TestUtils from 'react-addons-test-utils' import * as App from '../../modules/actions/App.js'
There is a config.js module in app/ . It is imported where necessary.
The problem is that when I run my Jest tests, such as App-test.js, it searches for the configuration and does not find it:
FAIL __tests__/actions/App-test.js Runtime Error Error: Cannot find module 'config' from 'User.js'
And User.js imports config like this: import config from 'config'
User.js uses another App.js action.
Any ideas?
javascript reactjs redux jestjs
Erik johnson
source share