{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/367","labels_url":"https://api.github.com/repos/facebook/jest/issues/367/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/367/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/367/events","html_url":"https://github.com/facebook/jest/issues/367","id":76225780,"number":367,"title":"Cannot find module 'react/addons' from test js","user":{"login":"buddyp450","id":2916894,"avatar_url":"https://avatars.githubusercontent.com/u/2916894?v=3","gravatar_id":"","url":"https://api.github.com/users/buddyp450","html_url":"https://github.com/buddyp450","followers_url":"https://api.github.com/users/buddyp450/followers","following_url":"https://api.github.com/users/buddyp450/following{/other_user}","gists_url":"https://api.github.com/users/buddyp450/gists{/gist_id}","starred_url":"https://api.github.com/users/buddyp450/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buddyp450/subscriptions","organizations_url":"https://api.github.com/users/buddyp450/orgs","repos_url":"https://api.github.com/users/buddyp450/repos","events_url":"https://api.github.com/users/buddyp450/events{/privacy}","received_events_url":"https://api.github.com/users/buddyp450/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-05-14T04:27:14Z","updated_at":"2015-06-26T02:26:50Z","closed_at":null,"body":"Running `iojs ./node_modules/jest-cli/bin/jest.js` via script in package.json results in:\r\n\r\n```shell\r\nUsing Jest CLI v0.4.3\r\nWaiting on 1 test...\r\n FAIL  __tests__\\BuildingTable-test.js (1.265s)\r\n? BuildingTable > it encountered a declaration exception\r\n  - Error: Cannot find module 'react/addons' from 'C:\\Git\\react\\__tests__\\BuildingTable-test.js'\r\n      at Loader._getNormalizedModuleID (C:\\Git\\react\\node_modules\\jest-cli\\src\\HasteModuleLoader\\HasteModuleLoader.js:360:15)\r\n      at Loader._shouldMock (C:\\Git\\react\\node_modules\\jest-cli\\src\\HasteModuleLoader\\HasteModuleLoader.js:566:23)\r\n      at Loader.requireModuleOrMock (C:\\Git\\react\\node_modules\\jest-cli\\src\\HasteModuleLoader\\HasteModuleLoader.js:934:12)\r\n      at Object.runContentWithLocalBindings (C:\\Git\\react\\node_modules\\jest-cli\\src\\lib\\utils.js:376:17)\r\n      at Loader._execModule (C:\\Git\\react\\node_modules\\jest-cli\\src\\HasteModuleLoader\\HasteModuleLoader.js:250:9)\r\n      at Loader.requireModule (C:\\Git\\react\\node_modules\\jest-cli\\src\\HasteModuleLoader\\HasteModuleLoader.js:916:12)\r\n      at jasmineTestRunner (C:\\Git\\react\\node_modules\\jest-cli\\src\\jasmineTestRunner\\jasmineTestRunner.js:245:16)\r\n      at C:\\Git\\react\\node_modules\\jest-cli\\src\\TestRunner.js:372:12\r\n      at _fulfilled (C:\\Git\\react\\node_modules\\jest-cli\\node_modules\\q\\q.js:798:54)\r\n      at self.promiseDispatch.done (C:\\Git\\react\\node_modules\\jest-cli\\node_modules\\q\\q.js:827:30)\r\n      at Promise.promise.promiseDispatch (C:\\Git\\react\\node_modules\\jest-cli\\node_modules\\q\\q.js:760:13)\r\n      at C:\\Git\\react\\node_modules\\jest-cli\\node_modules\\q\\q.js:574:44\r\n      at flush (C:\\Git\\react\\node_modules\\jest-cli\\node_modules\\q\\q.js:108:17)\r\n      at doNTCallback0 (node.js:415:9)\r\n      at process._tickCallback (node.js:344:13)\r\n```\r\n\r\nMy building test js:\r\n\r\n```javascript\r\njest.dontMock('../app/views/building-table/BuildingTable');\r\njest.dontMock('es6-promise');\r\nrequire('es6-promise').polyfill();\r\n\r\ndescribe('BuildingTable', function() {\r\n    var React = require('react/addons')\r\n\r\n    it(`should at least make it this far`, () => {\r\n         expect(true).toBe(true);\r\n    });\r\n})\r\n```\r\n\r\nStill very new to this so apologies if I'm missing something obvious.\r\n\r\n```shell\r\n> iojs --version\r\nv2.0.1\r\n> npm --version\r\n2.9.0\r\n```\r\n\r\nMy package.json:\r\n\r\n```json\r\n{\r\n  \"name\": \"JSDependencyHell\",\r\n  \"version\": \"0.0.1\",\r\n  \"scripts\": {\r\n    \"init\": \"npm install & iojs ./node_modules/jspm/jspm.js install\",\r\n    \"start\": \"iojs ./node_modules/gulp/bin/gulp.js\",\r\n    \"test\": \"iojs ./node_modules/jest-cli/bin/jest.js\"\r\n  },\r\n  \"jest\": {\r\n    \"scriptPreprocessor\": \"./node_modules/babel-jest\",\r\n    \"unmockedModulePathPatterns\": [\r\n      \"react\",\r\n      \"immutable\"\r\n    ],\r\n    \"testPathIgnorePatterns\": [\r\n      \"/node_modules/\",\r\n      \"/jspm_modules/\"\r\n    ],\r\n    \"testFileExtensions\": [\r\n      \"jsx\",\r\n      \"js\"\r\n    ],\r\n    \"moduleFileExtensions\": [\r\n      \"js\",\r\n      \"jsx\"\r\n    ]\r\n  },\r\n  \"jspm\": {\r\n    \"directories\": {\r\n      \"lib\": \"lib\",\r\n      \"packages\": \"jspm_modules\"\r\n    },\r\n    \"dependencies\": {\r\n      \"bootstrap\": \"github:twbs/bootstrap@^3.3.4\",\r\n      \"es6-promise\": \"npm:es6-promise@^2.0.1\",\r\n      \"font-awesome\": \"npm:font-awesome@^4.3.0\",\r\n      \"jquery\": \"github:components/jquery@^2.1.3\",\r\n      \"jsx\": \"github:zcregan/plugin-babeljsx@^0.2.0\",\r\n      \"lodash\": \"npm:lodash@^3.3.0\",\r\n      \"lodash-node\": \"npm:lodash-node@^3.2.0\",\r\n      \"page\": \"npm:page@^1.6.1\",\r\n      \"pleasejs\": \"npm:pleasejs@^0.4.2\",\r\n      \"react\": \"npm:react@^0.13.2\",\r\n      \"react-grid-layout\": \"npm:react-grid-layout@^0.8.1\",\r\n      \"react-resizable\": \"npm:react-resizable@^0.3.2\",\r\n      \"react-select\": \"npm:react-select@^0.3.2\",\r\n      \"reactable\": \"npm:reactable@^0.10.1\",\r\n      \"readable-stream\": \"npm:readable-stream@^1.1.13\",\r\n      \"reflux\": \"npm:reflux@^0.2.5\",\r\n      \"stream-browserify\": \"npm:stream-browserify@^1.0.0\"\r\n    },\r\n    \"devDependencies\": {\r\n      \"babel\": \"npm:babel-core@^5.1.13\",\r\n      \"babel-runtime\": \"npm:babel-runtime@^5.1.13\",\r\n      \"core-js\": \"npm:core-js@^0.9.4\"\r\n    }\r\n  },\r\n  \"devDependencies\": {\r\n    \"babel-core\": \"^5.3.3\",\r\n    \"babel-jest\": \"^5.2.0\",\r\n    \"browser-sync\": \"^2.7.1\",\r\n    \"gulp\": \"^3.8.11\",\r\n    \"gulp-less\": \"^3.0.0\",\r\n    \"gulp-load-plugins\": \"^0.8.0\",\r\n    \"gulp-react\": \"^2.0.0\",\r\n    \"gulp-shell\": \"^0.3.0\",\r\n    \"gulp-util\": \"^3.0.3\",\r\n    \"http-proxy\": \"^1.8.1\",\r\n    \"jest-cli\": \"^0.4.3\",\r\n    \"jspm\": \"^0.15.1\",\r\n    \"jspm-git\": \"^0.3.2\",\r\n    \"systemjs-builder\": \"^0.9.0\"\r\n  }\r\n}\r\n\r\n```\r\n\r\nWould really appreciate even a point in the right direction.. thanks!"},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/115465339","html_url":"https://github.com/facebook/jest/issues/367#issuecomment-115465339","issue_url":"https://api.github.com/repos/facebook/jest/issues/367","id":115465339,"user":{"login":"buddyp450","id":2916894,"avatar_url":"https://avatars.githubusercontent.com/u/2916894?v=3","gravatar_id":"","url":"https://api.github.com/users/buddyp450","html_url":"https://github.com/buddyp450","followers_url":"https://api.github.com/users/buddyp450/followers","following_url":"https://api.github.com/users/buddyp450/following{/other_user}","gists_url":"https://api.github.com/users/buddyp450/gists{/gist_id}","starred_url":"https://api.github.com/users/buddyp450/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buddyp450/subscriptions","organizations_url":"https://api.github.com/users/buddyp450/orgs","repos_url":"https://api.github.com/users/buddyp450/repos","events_url":"https://api.github.com/users/buddyp450/events{/privacy}","received_events_url":"https://api.github.com/users/buddyp450/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T02:26:50Z","updated_at":"2015-06-26T02:26:50Z","body":"@ProggerPete the problem with this is that all of my modules use import statements that go looking for things using the SystemJS loader. For instance, in my BuildingTable.jsx my import looks like:\r\n\r\n```javascript\r\nimport React from 'react'\r\nimport Submodule from 'api/submodule'\r\nimport Util from 'util/MyUtil'\r\n...\r\n```\r\n\r\nSo that when the imports resolve for my test runner it's trying to look inside of node_modules for things that don't exist. Granted I could install react under node_modules using ```npm install react --save-dev``` to only have it in my development environment but that doesn't answer for my Submodule and Utils. Keep in mind I don't want to have to change this style because it works fine as it is just not for unit testing.\r\n\r\nIn a browser environment I can load up SystemJS from my jspm_modules, resolve my config.js import script which handles all the \"System.config\" stuff for SystemJS including setting my baseURL, paths, map and then finally import my main app.\r\n\r\nI'm not sure really where-in the problem lies: do I have a ridiculous project setup? Most of my modules are inside of jspm_modules but I have other modules throughout my project that I like being able to reference like ```import api from 'api/someapi'```, ```import someStore from 'stores/some-store'```, and ```import FancyFrame from 'layout/frames/FancyFrame'```.\r\n\r\nEach of those top level names reference areas of my project. Some may reference npm modules, some may reference app modules, some are bitbucket/github/vendor modules.... point being... MODULES EVERYWHERE. Luckily SystemJS saves the day by allowing me to properly map things to where they should be found."}}