{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/1950","repository_url":"https://api.github.com/repos/facebook/jest","labels_url":"https://api.github.com/repos/facebook/jest/issues/1950/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/1950/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/1950/events","html_url":"https://github.com/facebook/jest/issues/1950","id":183785899,"number":1950,"title":"Log warning when same file is required with different cases","user":{"login":"blainekasten","id":2916023,"avatar_url":"https://avatars.githubusercontent.com/u/2916023?v=3","gravatar_id":"","url":"https://api.github.com/users/blainekasten","html_url":"https://github.com/blainekasten","followers_url":"https://api.github.com/users/blainekasten/followers","following_url":"https://api.github.com/users/blainekasten/following{/other_user}","gists_url":"https://api.github.com/users/blainekasten/gists{/gist_id}","starred_url":"https://api.github.com/users/blainekasten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blainekasten/subscriptions","organizations_url":"https://api.github.com/users/blainekasten/orgs","repos_url":"https://api.github.com/users/blainekasten/repos","events_url":"https://api.github.com/users/blainekasten/events{/privacy}","received_events_url":"https://api.github.com/users/blainekasten/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-18T19:52:16Z","updated_at":"2016-10-27T02:30:17Z","closed_at":"2016-10-24T07:56:50Z","body":"\r\n**Do you want to request a *feature* or report a *bug*?**\r\nbug, I think.\r\n\r\n**What is the current behavior?**\r\nThis mostly concerns mocking behavior.\r\nIf your test file, and your actual file both import the same code under different case's, then the test is actually given different mock \"instances\" of that file leading to confusingly breaking tests.\r\n\r\nExample:\r\n\r\n```js\r\n// add.js\r\n\r\nexport default function add(a, b) {\r\n  return a + b;\r\n}\r\n```\r\n\r\n```js\r\n// uses-add.js\r\nimport add from 'Add';  // !!! note - capitalized\r\n\r\nexport default function usesAdd(a, b) {\r\n  return add(a, b);\r\n}\r\n```\r\n\r\n```js\r\n// uses-add-test.js\r\njest.enableAutomock();\r\n\r\nconst add = require('add');  // !!! note - noncapitalized\r\nconst usesAdd = require.requireActual('uses-add');\r\n\r\nusesAdd(1, 2);\r\nexpect(add).toBeCalledWith(1, 2); // fail\r\n```\r\n\r\nIt says it never gets called.\r\n\r\nI think that jest should log a warning or error when a user does this, to help debug."},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/256530442","html_url":"https://github.com/facebook/jest/issues/1950#issuecomment-256530442","issue_url":"https://api.github.com/repos/facebook/jest/issues/1950","id":256530442,"user":{"login":"cpojer","id":13352,"avatar_url":"https://avatars.githubusercontent.com/u/13352?v=3","gravatar_id":"","url":"https://api.github.com/users/cpojer","html_url":"https://github.com/cpojer","followers_url":"https://api.github.com/users/cpojer/followers","following_url":"https://api.github.com/users/cpojer/following{/other_user}","gists_url":"https://api.github.com/users/cpojer/gists{/gist_id}","starred_url":"https://api.github.com/users/cpojer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpojer/subscriptions","organizations_url":"https://api.github.com/users/cpojer/orgs","repos_url":"https://api.github.com/users/cpojer/repos","events_url":"https://api.github.com/users/cpojer/events{/privacy}","received_events_url":"https://api.github.com/users/cpojer/received_events","type":"User","site_admin":false},"created_at":"2016-10-27T02:30:17Z","updated_at":"2016-10-27T02:30:17Z","body":"I totally get what you are saying Blaine. As I said, I do believe it should be part of a linter and I can see it become a default in popular default lint configurations.\r\n\r\nHowever, since other require implementations work the same way, I'm not inclined to change Jest. We aim to be compatible and there may be legit (although crazy!) reasons why people may do this right now. I've seen everything in the node ecosystem ;)"}}
{"actor":{"display_login":"cpojer"}}