{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/521","labels_url":"https://api.github.com/repos/facebook/jest/issues/521/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/521/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/521/events","html_url":"https://github.com/facebook/jest/issues/521","id":108424337,"number":521,"title":"Caching causing issues","user":{"login":"hgezim","id":124675,"avatar_url":"https://avatars.githubusercontent.com/u/124675?v=3","gravatar_id":"","url":"https://api.github.com/users/hgezim","html_url":"https://github.com/hgezim","followers_url":"https://api.github.com/users/hgezim/followers","following_url":"https://api.github.com/users/hgezim/following{/other_user}","gists_url":"https://api.github.com/users/hgezim/gists{/gist_id}","starred_url":"https://api.github.com/users/hgezim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgezim/subscriptions","organizations_url":"https://api.github.com/users/hgezim/orgs","repos_url":"https://api.github.com/users/hgezim/repos","events_url":"https://api.github.com/users/hgezim/events{/privacy}","received_events_url":"https://api.github.com/users/hgezim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-25T23:38:53Z","updated_at":"2015-10-05T18:18:14Z","closed_at":null,"body":"I discovered an issue that appears to be caused by caching. On the initial run of a test, it evaluates the test and determines that it fails (without errors), however on subsequent runs, I get: `Cannot find module './emptyFunction' from 'node_modules/jest-cli/.haste_cache/preprocess-cache/warning_764896bb1571a8dbaa5c10886672e1b1.js'`:\r\n\r\nI will demonstrate that in the following command line log. The first run is a subsequent run (not initial). I then reinstall `jest-cli` to remove caching and rerun the jest at which I get no errors. I then run it again and get the error.\r\n\r\n    $ jest \"components/__tests__/Logs-test.js\"\r\n    Using Jest CLI v0.5.8\r\n     FAIL  components/__tests__/Logs-test.js (6.106s)\r\n    ● Logs › it should render one log entry\r\n      - Error: components/Logs.jsx: components/UI/Button.jsx: node_modules/react-router/lib/Link.js: node_modules/jest-cli/.haste_cache/preprocess-cache/warning_9639d273552fc3d10e9d82c0b9a7ffe7_0cf03796f2d31f7d5a0ad1dbaa0b1815.js: Cannot find module './emptyFunction' from 'node_modules/jest-cli/.haste_cache/preprocess-cache/warning_9639d273552fc3d10e9d82c0b9a7ffe7_0cf03796f2d31f7d5a0ad1dbaa0b1815.js'\r\n          at Loader._getNormalizedModuleID (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:346:15)\r\n          at Loader._shouldMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:555:23)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:917:12)\r\n          at Object.<anonymous> (node_modules/jest-cli/.haste_cache/preprocess-cache/warning_9639d273552fc3d10e9d82c0b9a7ffe7_0cf03796f2d31f7d5a0ad1dbaa0b1815.js:14:21)\r\n          at Object.runContentWithLocalBindings (node_modules/jest-cli/src/lib/utils.js:517:17)\r\n          at Loader._execModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:236:9)\r\n          at Loader.requireModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:899:12)\r\n          at Loader._generateMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:267:30)\r\n          at Loader.requireMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:795:43)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:918:17)\r\n          at Object.<anonymous> (node_modules/react-router/lib/Link.js:15:16)\r\n          at Object.runContentWithLocalBindings (node_modules/jest-cli/src/lib/utils.js:517:17)\r\n          at Loader._execModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:236:9)\r\n          at Loader.requireModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:899:12)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:920:17)\r\n          at Object.<anonymous> (components/UI/Button.jsx:2:12)\r\n          at Object.runContentWithLocalBindings (node_modules/jest-cli/src/lib/utils.js:517:17)\r\n          at Loader._execModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:236:9)\r\n          at Loader.requireModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:899:12)\r\n          at Loader._generateMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:267:30)\r\n          at Loader.requireMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:795:43)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:918:17)\r\n          at Object.<anonymous> (components/Logs.jsx:7:14)\r\n          at Object.runContentWithLocalBindings (node_modules/jest-cli/src/lib/utils.js:517:17)\r\n          at Loader._execModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:236:9)\r\n          at Loader.requireModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:899:12)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:920:17)\r\n          at Spec.<anonymous> (components/__tests__/Logs-test.js:30:12)\r\n        \r\n      - Expected: 0 toBe: 1\r\n            at Spec.<anonymous> (components/__tests__/Logs-test.js:56:15)\r\n    1 test failed, 0 tests passed (1 total)\r\n    Run time: 6.791s\r\n    $ rm -rf node_modules/jest-cli/\r\n    $ npm install jest-cli\r\n    jest-cli@0.5.8 # ... INSTALL OUTPUT ...\r\n    $ jest \"components/__tests__/Logs-test.js\"\r\n    Using Jest CLI v0.5.8\r\n     FAIL  components/__tests__/Logs-test.js (17.728s)\r\n    ● Logs › it should render one log entry\r\n      - Expected: 0 toBe: 1\r\n            at Spec.<anonymous> (components/__tests__/Logs-test.js:56:15)\r\n    1 test failed, 0 tests passed (1 total)\r\n    Run time: 18.284s\r\n    $ jest \"components/__tests__/Logs-test.js\"\r\n    Using Jest CLI v0.5.8\r\n     FAIL  components/__tests__/Logs-test.js (6.197s)\r\n    ● Logs › it should render one log entry\r\n      - Error: components/Logs.jsx: components/UI/Button.jsx: node_modules/react-router/lib/Link.js: node_modules/jest-cli/.haste_cache/preprocess-cache/warning_764896bb1571a8dbaa5c10886672e1b1.js: Cannot find module './emptyFunction' from 'node_modules/jest-cli/.haste_cache/preprocess-cache/warning_764896bb1571a8dbaa5c10886672e1b1.js'\r\n          at Loader._getNormalizedModuleID (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:346:15)\r\n          at Loader._shouldMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:555:23)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:917:12)\r\n          at Object.<anonymous> (node_modules/jest-cli/.haste_cache/preprocess-cache/warning_764896bb1571a8dbaa5c10886672e1b1.js:14:21)\r\n          at Object.runContentWithLocalBindings (node_modules/jest-cli/src/lib/utils.js:517:17)\r\n          at Loader._execModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:236:9)\r\n          at Loader.requireModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:899:12)\r\n          at Loader._generateMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:267:30)\r\n          at Loader.requireMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:795:43)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:918:17)\r\n          at Object.<anonymous> (node_modules/react-router/lib/Link.js:15:16)\r\n          at Object.runContentWithLocalBindings (node_modules/jest-cli/src/lib/utils.js:517:17)\r\n          at Loader._execModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:236:9)\r\n          at Loader.requireModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:899:12)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:920:17)\r\n          at Object.<anonymous> (components/UI/Button.jsx:2:12)\r\n          at Object.runContentWithLocalBindings (node_modules/jest-cli/src/lib/utils.js:517:17)\r\n          at Loader._execModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:236:9)\r\n          at Loader.requireModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:899:12)\r\n          at Loader._generateMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:267:30)\r\n          at Loader.requireMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:795:43)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:918:17)\r\n          at Object.<anonymous> (components/Logs.jsx:7:14)\r\n          at Object.runContentWithLocalBindings (node_modules/jest-cli/src/lib/utils.js:517:17)\r\n          at Loader._execModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:236:9)\r\n          at Loader.requireModule (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:899:12)\r\n          at Loader.requireModuleOrMock (node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:920:17)\r\n          at Spec.<anonymous> (components/__tests__/Logs-test.js:30:12)\r\n        \r\n      - Expected: 0 toBe: 1\r\n            at Spec.<anonymous> (components/__tests__/Logs-test.js:56:15)\r\n    1 test failed, 0 tests passed (1 total)\r\n    Run time: 6.854s\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/145621103","html_url":"https://github.com/facebook/jest/issues/521#issuecomment-145621103","issue_url":"https://api.github.com/repos/facebook/jest/issues/521","id":145621103,"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":"2015-10-05T18:18:14Z","updated_at":"2015-10-05T18:18:14Z","body":"Yeah I think the problem is that it stringifies the `config` object as well and the encoding isn't stable, ie. the keys in the config object are sorted randomly. I'm not sure why that would lead to problems however, it just leads to more work for the pre-processor. But yeah, this should be fixed."}}