{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/433","labels_url":"https://api.github.com/repos/facebook/jest/issues/433/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/433/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/433/events","html_url":"https://github.com/facebook/jest/issues/433","id":94980249,"number":433,"title":"Empty coverage","user":{"login":"roman01la","id":1355501,"avatar_url":"https://avatars.githubusercontent.com/u/1355501?v=3","gravatar_id":"","url":"https://api.github.com/users/roman01la","html_url":"https://github.com/roman01la","followers_url":"https://api.github.com/users/roman01la/followers","following_url":"https://api.github.com/users/roman01la/following{/other_user}","gists_url":"https://api.github.com/users/roman01la/gists{/gist_id}","starred_url":"https://api.github.com/users/roman01la/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roman01la/subscriptions","organizations_url":"https://api.github.com/users/roman01la/orgs","repos_url":"https://api.github.com/users/roman01la/repos","events_url":"https://api.github.com/users/roman01la/events{/privacy}","received_events_url":"https://api.github.com/users/roman01la/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-07-14T16:08:52Z","updated_at":"2015-10-21T18:12:20Z","closed_at":null,"body":"I'm struggling to get code coverage with Jest.\r\n\r\nHere's a sample component I'm running tests on:\r\n```js\r\nvar React = require('react');\r\n\r\nvar Input = React.createClass({\r\n  render: function() {\r\n    var placeholder = this.props.placeholder,\r\n        value = this.props.value,\r\n        name = this.props.name;\r\n\r\n    return React.DOM.div({\r\n      className: 'field'\r\n    }, [\r\n      React.DOM.label({\r\n        htmlFor: name\r\n      }),\r\n      React.DOM.input({\r\n        name: name,\r\n        value: value,\r\n        type: 'text',\r\n        placeholder: placeholder\r\n      })\r\n    ]);\r\n  }\r\n});\r\n\r\nmodule.exports = Input;\r\n```\r\n\r\nAnd here's a test file:\r\n```js\r\njest.dontMock('../../../components/input');\r\n\r\nvar React, TestUtils, Input;\r\n\r\nvar input;\r\n\r\nvar placeholder = 'placeholder',\r\n    name = 'name',\r\n    value = 'value';\r\n\r\ndescribe('Input', function() {\r\n\r\n  it('should render props', function() {\r\n\r\n    React = require('react/addons');\r\n    TestUtils = React.addons.TestUtils;\r\n    Input = require('../../../components/input');\r\n\r\n    input = TestUtils.renderIntoDocument(\r\n      React.createElement(Input, {\r\n        name: name,\r\n        value: value,\r\n        placeholder: placeholder\r\n      }));\r\n\r\n    var inputTag = TestUtils.findRenderedDOMComponentWithTag(input, 'input')\r\n          .getDOMNode();\r\n\r\n    expect(inputTag.getAttribute('placeholder')).toEqual(placeholder);\r\n    expect(inputTag.getAttribute('name')).toEqual(name);\r\n    expect(inputTag.getAttribute('value')).toEqual(value);\r\n  });\r\n});\r\n```\r\n\r\nAnd also Jest settings from `package.json`:\r\n```json\r\n {\r\n    \"collectCoverage\": true,\r\n    \"testDirectoryName\": \"test/unit\",\r\n    \"rootDir\": \"./src\",\r\n    \"unmockedModulePathPatterns\": [\r\n      \"./node_modules/react\"\r\n    ]\r\n  }\r\n```\r\n\r\nAll paths a valid. I've been debugging Jest and found out that [`moduleLoader.getDependenciesFromPath(testFilePath)`](https://github.com/facebook/jest/blob/c229ed1a4ff198559f3edc6ee4baf0894312fd7a/src/TestRunner.js#L353) returns empty array. So for some reason it can not get dependencies of the test file."},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/149981688","html_url":"https://github.com/facebook/jest/issues/433#issuecomment-149981688","issue_url":"https://api.github.com/repos/facebook/jest/issues/433","id":149981688,"user":{"login":"rafaelmaiolla","id":2466001,"avatar_url":"https://avatars.githubusercontent.com/u/2466001?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelmaiolla","html_url":"https://github.com/rafaelmaiolla","followers_url":"https://api.github.com/users/rafaelmaiolla/followers","following_url":"https://api.github.com/users/rafaelmaiolla/following{/other_user}","gists_url":"https://api.github.com/users/rafaelmaiolla/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelmaiolla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelmaiolla/subscriptions","organizations_url":"https://api.github.com/users/rafaelmaiolla/orgs","repos_url":"https://api.github.com/users/rafaelmaiolla/repos","events_url":"https://api.github.com/users/rafaelmaiolla/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelmaiolla/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T18:12:20Z","updated_at":"2015-10-21T18:12:20Z","body":"+1"}}