jest icon indicating copy to clipboard operation
jest copied to clipboard

Initially virtual mocks declared in `scriptTestFrameworkScriptFile` worked not anymore

Open anilreddykatta opened this issue 8 years ago • 3 comments

Do you want to request a feature or report a bug?

What is the current behavior? Configuration error:

I declared in scripTestFrameworkScriptFile like this

jest.mock(
  'utils/xhr',
  () => ({
    get: () => Promise.resolve(),
    post: () => Promise.resolve(),
    put: () => Promise.resolve(),
    delete: () => Promise.resolve(),
  }),
  {
    virtual: true,
  }
)

and also have an entry in

moduleNameMapper: {
   "^utils/(.*)$": "<rootDir>/src/utils/$1",
}

When I upgraded from Jest20 to Jest 22 it started throwing this error, failing all my test cases Could not locate module utils/xhr (mapped as /Users/xxxx/Desktop/Projects/diff-lib/xxxx/src/utils/xhr)

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

anilreddykatta avatar Dec 20 '17 18:12 anilreddykatta

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Feb 25 '22 17:02 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] avatar Mar 27 '22 18:03 github-actions[bot]

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.

github-actions[bot] avatar Apr 27 '22 00:04 github-actions[bot]