{"action":"created","issue":{"url":"https://api.github.com/repos/jest-community/vscode-jest/issues/370","repository_url":"https://api.github.com/repos/jest-community/vscode-jest","labels_url":"https://api.github.com/repos/jest-community/vscode-jest/issues/370/labels{/name}","comments_url":"https://api.github.com/repos/jest-community/vscode-jest/issues/370/comments","events_url":"https://api.github.com/repos/jest-community/vscode-jest/issues/370/events","html_url":"https://github.com/jest-community/vscode-jest/issues/370","id":354462299,"node_id":"MDU6SXNzdWUzNTQ0NjIyOTk=","number":370,"title":"Coverage overlay does not appear if coverage was collected with `jest --coverage` rather than `collectCoverage: true` in `jest.config.js`","user":{"login":"garyking","id":343940,"node_id":"MDQ6VXNlcjM0Mzk0MA==","avatar_url":"https://avatars2.githubusercontent.com/u/343940?v=4","gravatar_id":"","url":"https://api.github.com/users/garyking","html_url":"https://github.com/garyking","followers_url":"https://api.github.com/users/garyking/followers","following_url":"https://api.github.com/users/garyking/following{/other_user}","gists_url":"https://api.github.com/users/garyking/gists{/gist_id}","starred_url":"https://api.github.com/users/garyking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyking/subscriptions","organizations_url":"https://api.github.com/users/garyking/orgs","repos_url":"https://api.github.com/users/garyking/repos","events_url":"https://api.github.com/users/garyking/events{/privacy}","received_events_url":"https://api.github.com/users/garyking/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-08-27T20:17:03Z","updated_at":"2018-12-03T16:36:24Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Environment\r\n\r\n1. `node -v`: v8.11.2\r\n1. `npm -v`: 6.4.0\r\n1. `npm ls jest` or `npm ls react-scripts` (if you haven’t ejected): jest@23.5.0\r\n1. your vscode-jest settings if customized:\r\n\r\n```\r\n  \"jest.enableCodeLens\": false,\r\n  \"jest.pathToJest\": \"node_modules/.bin/jest\",\r\n```\r\n\r\n1. Operating system: Mac 10.13.5 (17F77)\r\n\r\n### Prerequisite\r\n- are you able to run jest test from command line? Yes\r\n- how do yo run your tests from command line? (for example: `npm run test` or `node_modules/.bin/jest`) `jest --coverage`\r\n\r\n### Steps to Reproduce\r\n\r\n<!-- Please create a repository that reproduces the issue with the minimal amount of code possible. -->\r\n\r\nIf a project does not have `collectCoverage: true` in `jest.config.js`, and instead collects coverage through `jest --coverage`, then this extension does not show the coverage overlay for the project. I'm talking about the small text at the top of the file does not appear, and the color highlighting does not appear, when using Toggle Coverage Overlay, even though there is uncovered code in the file.\r\n\r\nThe output of both methods of coverage collection result in the exact same HTML output, so I don't know why it would matter, but it definitely seems to. I'm guessing because this extension only looks for that key in the config, rather than checking the existence of the coverage files themselves?\r\n\r\nIf I add `collectCoverage: true` to `jest.config.js`, then run `npx jest`, then reload VSC, then the overlay will work."},"comment":{"url":"https://api.github.com/repos/jest-community/vscode-jest/issues/comments/443776087","html_url":"https://github.com/jest-community/vscode-jest/issues/370#issuecomment-443776087","issue_url":"https://api.github.com/repos/jest-community/vscode-jest/issues/370","id":443776087,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0Mzc3NjA4Nw==","user":{"login":"connectdotz","id":891093,"node_id":"MDQ6VXNlcjg5MTA5Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/891093?v=4","gravatar_id":"","url":"https://api.github.com/users/connectdotz","html_url":"https://github.com/connectdotz","followers_url":"https://api.github.com/users/connectdotz/followers","following_url":"https://api.github.com/users/connectdotz/following{/other_user}","gists_url":"https://api.github.com/users/connectdotz/gists{/gist_id}","starred_url":"https://api.github.com/users/connectdotz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connectdotz/subscriptions","organizations_url":"https://api.github.com/users/connectdotz/orgs","repos_url":"https://api.github.com/users/connectdotz/repos","events_url":"https://api.github.com/users/connectdotz/events{/privacy}","received_events_url":"https://api.github.com/users/connectdotz/received_events","type":"User","site_admin":false},"created_at":"2018-12-03T16:36:24Z","updated_at":"2018-12-03T16:36:24Z","author_association":"COLLABORATOR","body":"looks like there are a few issues entangled in this thread:\r\n\r\n- First, it's important to separate the coverage summary (_the small text appeared on the top of the src file_) from coverage overlay: summary should appear as long as jest produced the coverage info,; while overlays would have an extra dependency - sourcemap - to map source location for the transpiled files such as typescripts. \r\n\r\n`vscode-jest` won't be able to generate such sourcemap as it is highly depending on your transpile mechanisms (babel, react-native, typescripts etc) and therefore it's your responsibility to ensure such map is produced... (although some examples in the doc might be quite helpful...)\r\n\r\n- Now let's look at the original question:\r\n\r\n> Coverage overlay does not appear if coverage was collected with `jest --coverage` rather than `collectCoverage: true` in `jest.config.js`\r\n\r\nI tried both ways in the sample repo and found no such discrepency, as far as the coverage summary goes (since we are testing if the coverage is run).\r\n\r\nOne thing to note that when you update the config file, jest (if it findes it) will automatically pick up; but to add the command line option, you will have to configure it via `jest.pathToJest`, which you can verify by turning on the [debug mode](https://github.com/jest-community/vscode-jest/blob/677d91830e589a580faad9fb68347320073f296c/README.md#plugin-not-running-as-expect-try-self-diagnosis).\r\n\r\n- Now the overlay, yes the overlay is not displayed properly in your repo, which you did the right thing to separate it into different issue.\r\n\r\n- for people who had problem passing `--coverage`, if you can't provide a sample repo to showcase such scenario, I am afraid there is not much to go on...\r\n\r\n"}}
{"actor":{"display_login":"connectdotz"}}