question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module 'store/actions/user' from 'login-form.js'

See original GitHub issue

i have this jest configuration

"jest": {
      "transform": {
        "^.+\\.jsx?$": "babel-jest",
        ".*": "./tests/preprocessor.js"
      },
      "moduleFileExtensions": [
        "js",
        "jsx",
        "json"
      ],
      "setupFiles": [
        "./tests/enzyme_setup"
      ],
      "moduleDirectories": [
        "node_modules",
        "bower_components",
        "shared"
      ]
    }

and im using react redux and im getting this error

Test suite failed to run

Cannot find module 'store/actions/user' from 'login-form.js'

  2 | import * as PropTypes from 'prop-types';
  3 |
> 4 | import { userActionsShape } from 'store/actions/user';
  5 | import Scss from './scss/index.scss'
  6 |
  7 | export class LoginFormComponent extends React.Component {

  at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:194:17)
  at Object.<anonymous> (src/app/components/auth/login-form/login-form.js:4:13)

can someone please help me im stuck on this

thanks in advance carlos vieira

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
thymikeecommented, Feb 21, 2018

You need a moduleNameMapper to use absolute paths like 'store/actions/user'. See webpack guide on that: https://facebook.github.io/jest/docs/en/webpack.html#a-webpack-example

0reactions
github-actions[bot]commented, May 12, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'store/actions/user' from 'login-form.js'
i already solved i put this config jest { "transform": { "^.+\\.js$": "babel-jest", "^.+\\.jsx$": "<rootDir>/__tests__/enzyme_setup.js", "^.
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
The module (package) not found is always specified in the format "Module not found: Error: Can't resolve 'package name' in 'project directory".
Read more >
Fix a CloudWatch canary that's failing with the error "Cannot ...
The error message reads: Cannot find module ... under the nodejs/node_modules file path (such as nodejs/node_modules/myCanaryFilename.js).
Read more >
I have an error it says: Error: Cannot find module '.env'
[nodemon] starting node ./index.js node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module '.env' Require stack: ...
Read more >
Cannot find module 'lightning/flowSupport' from 'force-app ...
The lightning modules need to be mocked as jest doesn't have access to import modules like a lightning web component actually could.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found