Quantcast
Channel: Testing React component with Jest gives 'Cannot find module' error - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by Grazerbeam for Testing React component with Jest gives 'Cannot find...

This issue happened for me because the project had configurations in both package.json and jest.config.jspackage.json"jest": {"moduleNameMapper": {"^components(.*)$":...

View Article



Answer by Ji aSH for Testing React component with Jest gives 'Cannot find...

I think adding a module path to your jest config will do what you wantjest.config.jsmodule.exports = {"modulePaths": ["src","test" ], ...}edit: Oh your jest config is in package.json, so it should...

View Article

Testing React component with Jest gives 'Cannot find module' error

I am trying to test a React component using Jest.The component's code is the following.import React, { PureComponent } from 'react';import PropTypes from 'prop-types';import { Text } from...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images