{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/4427","repository_url":"https://api.github.com/repos/facebook/jest","labels_url":"https://api.github.com/repos/facebook/jest/issues/4427/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/4427/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/4427/events","html_url":"https://github.com/facebook/jest/issues/4427","id":255310510,"number":4427,"title":"Manual user mocks not working with custom resolver","user":{"login":"Xiphe","id":911218,"avatar_url":"https://avatars1.githubusercontent.com/u/911218?v=4","gravatar_id":"","url":"https://api.github.com/users/Xiphe","html_url":"https://github.com/Xiphe","followers_url":"https://api.github.com/users/Xiphe/followers","following_url":"https://api.github.com/users/Xiphe/following{/other_user}","gists_url":"https://api.github.com/users/Xiphe/gists{/gist_id}","starred_url":"https://api.github.com/users/Xiphe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xiphe/subscriptions","organizations_url":"https://api.github.com/users/Xiphe/orgs","repos_url":"https://api.github.com/users/Xiphe/repos","events_url":"https://api.github.com/users/Xiphe/events{/privacy}","received_events_url":"https://api.github.com/users/Xiphe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-05T15:08:02Z","updated_at":"2017-09-05T15:09:29Z","closed_at":null,"author_association":"NONE","body":"<!-- \r\nTHIS IS NOT A HELP FORUM. \r\nIf you are experiencing problems with setting up Jest, please make sure to visit our Help page: \r\nhttps://facebook.github.io/jest/help.html\r\n-->\r\n<!-- \r\nBefore creating an issue please check the following:\r\n* you are using the latest version of Jest\r\n* try re-installing your node_modules folder \r\n* run Jest once with `--no-cache` to see if that fixes the problem you are experiencing. \r\n-->\r\n\r\n**Do you want to request a *feature* or report a *bug*?**\r\n\r\nBug 🐞 \r\n\r\n**What is the current behavior?**\r\n\r\nGiven I have this jest config:\r\n```json\r\n{\r\n  \"resolver\": \"<rootDir>/customResolver\"\r\n}\r\n```\r\nAnd a module `<rootDir>/index.js`\r\nAnd a manual mock available in `<rootDir>/__mocks__/index.js`\r\nAnd a spec file mocking the `<rootDir>/index.js` module\r\nThen I expect the mocked module to be loaded in other modules and my spec\r\n**BUT** the original module is still being loaded\r\n\r\nWhen I remove the resolver option in my jest config\r\nThen everything works as expected\r\n\r\n**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`.**\r\n\r\nhttps://github.com/Xiphe/jest-custom-resolver-with-mocks\r\n\r\n**What is the expected behavior?**\r\n\r\nWhen I use `jest.mock` to mock a user module file\r\nThen I expect the mocked module to be loaded \r\nEven If I use a custom resolver\r\n\r\n**Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.**\r\n\r\nMinimal jest config to reproduce this error:\r\n```json\r\n{\r\n  \"resolver\": \"<rootDir>/customResolver\"\r\n}\r\n```\r\n\r\ncustomResolver.js\r\n```js\r\nmodule.exports = require('jest-resolve/build/default_resolver');\r\n```\r\n\r\nVersions\r\n - jest: 21.0.1\r\n - node: 8.4.0\r\n - npm: 5.4.0\r\n - OS: macOS 10.12.6\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/327206081","html_url":"https://github.com/facebook/jest/issues/4427#issuecomment-327206081","issue_url":"https://api.github.com/repos/facebook/jest/issues/4427","id":327206081,"user":{"login":"Xiphe","id":911218,"avatar_url":"https://avatars1.githubusercontent.com/u/911218?v=4","gravatar_id":"","url":"https://api.github.com/users/Xiphe","html_url":"https://github.com/Xiphe","followers_url":"https://api.github.com/users/Xiphe/followers","following_url":"https://api.github.com/users/Xiphe/following{/other_user}","gists_url":"https://api.github.com/users/Xiphe/gists{/gist_id}","starred_url":"https://api.github.com/users/Xiphe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xiphe/subscriptions","organizations_url":"https://api.github.com/users/Xiphe/orgs","repos_url":"https://api.github.com/users/Xiphe/repos","events_url":"https://api.github.com/users/Xiphe/events{/privacy}","received_events_url":"https://api.github.com/users/Xiphe/received_events","type":"User","site_admin":false},"created_at":"2017-09-05T15:09:29Z","updated_at":"2017-09-05T15:09:29Z","author_association":"NONE","body":"This is tightly coupled to https://github.com/facebook/jest/pull/4174 (https://github.com/facebook/jest/commit/de74b38aff9f0a91dcdaf5986d2a6f963b78cfdf)\r\n\r\nWhen I revert that change and link `jest-resolve` in my project, everything works as expected."}}
{"actor":{"display_login":"Xiphe"}}