{"action":"created","issue":{"url":"https://api.github.com/repos/istanbuljs/nyc/issues/776","repository_url":"https://api.github.com/repos/istanbuljs/nyc","labels_url":"https://api.github.com/repos/istanbuljs/nyc/issues/776/labels{/name}","comments_url":"https://api.github.com/repos/istanbuljs/nyc/issues/776/comments","events_url":"https://api.github.com/repos/istanbuljs/nyc/issues/776/events","html_url":"https://github.com/istanbuljs/nyc/issues/776","id":296129364,"number":776,"title":"Including all files when not using require or register","user":{"login":"cdibbs","id":314147,"avatar_url":"https://avatars3.githubusercontent.com/u/314147?v=4","gravatar_id":"","url":"https://api.github.com/users/cdibbs","html_url":"https://github.com/cdibbs","followers_url":"https://api.github.com/users/cdibbs/followers","following_url":"https://api.github.com/users/cdibbs/following{/other_user}","gists_url":"https://api.github.com/users/cdibbs/gists{/gist_id}","starred_url":"https://api.github.com/users/cdibbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdibbs/subscriptions","organizations_url":"https://api.github.com/users/cdibbs/orgs","repos_url":"https://api.github.com/users/cdibbs/repos","events_url":"https://api.github.com/users/cdibbs/events{/privacy}","received_events_url":"https://api.github.com/users/cdibbs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-10T20:05:15Z","updated_at":"2018-02-17T21:47:04Z","closed_at":null,"author_association":"NONE","body":"<!--Please use the template provided below when reporting bugs:-->\r\n## Expected Behavior\r\nWhen running a lesser-known testing framework (called [Alsatian][1]) with nyc and ts-node, there should be an option to cover all files, despite the absence of a `require` definition in the config.\r\n\r\n## Observed Behavior\r\nCoverage seems correct, in terms of individual files, but the results don't include files not directly imported by the tests. My understanding of `\"all\": true` that I've gleaned from issues and docs scattered about is that it won't actually include all files without a `require`. If I try to require `ts-node/register` with nyc (again, despite it seeming to work, coverage-wise, without that), then all desired files are included, but coverage becomes nonsense, highlighting random byte ranges.\r\n\r\n## Bonus Points! Code (or Repository) that Reproduces Issue\r\n`package.json` and [runner.ts][2]\r\n```json\r\n  \"scripts\": {\r\n    \"precover\": \"rimraf ./coverage/*\",\r\n    \"cover\": \"nyc npm run unittest\",\r\n    \"unittest\": \"ts-node --project tsconfig-xunit.json src/spec-lib/runner.ts\"    \r\n  },\r\n  \"nyc\": {\r\n    \"include\": [\r\n      \"src/lib/**\"\r\n    ],\r\n    \"extension\": [\r\n      \".ts\"\r\n    ],\r\n    \"exclude\": [\r\n      \"typings\",\r\n      \"**/*.d.ts\",\r\n      \"**/*.test.ts\",\r\n      \"**/*.spec.ts\"\r\n    ],\r\n    \"reporter\": [\r\n      \"json\",\r\n      \"html\"\r\n    ],\r\n    \"all\": true\r\n  }\r\n```\r\n## Forensic Information\r\n\r\n**Operating System:** the operating system you observed the issue on.\r\nWindows 10, Powershell\r\n\r\n**Environment Information:** information about your project's environment, see instructions below:\r\n1. run the following script:\r\n\r\nsh -c 'node --version; npm --version; npm ls' > output.txt\r\n\r\n2. share a gist with the contents of output.txt.\r\n[gist of output.txt][output]\r\n\r\n[1]: https://github.com/alsatian-test/alsatian\r\n[2]: https://github.com/alsatian-test/alsatian/wiki/running-with-ts-node\r\n[output]: https://gist.github.com/cdibbs/4d66e319e8f745c019143a530afc8250"},"comment":{"url":"https://api.github.com/repos/istanbuljs/nyc/issues/comments/366473869","html_url":"https://github.com/istanbuljs/nyc/issues/776#issuecomment-366473869","issue_url":"https://api.github.com/repos/istanbuljs/nyc/issues/776","id":366473869,"user":{"login":"cdibbs","id":314147,"avatar_url":"https://avatars3.githubusercontent.com/u/314147?v=4","gravatar_id":"","url":"https://api.github.com/users/cdibbs","html_url":"https://github.com/cdibbs","followers_url":"https://api.github.com/users/cdibbs/followers","following_url":"https://api.github.com/users/cdibbs/following{/other_user}","gists_url":"https://api.github.com/users/cdibbs/gists{/gist_id}","starred_url":"https://api.github.com/users/cdibbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdibbs/subscriptions","organizations_url":"https://api.github.com/users/cdibbs/orgs","repos_url":"https://api.github.com/users/cdibbs/repos","events_url":"https://api.github.com/users/cdibbs/events{/privacy}","received_events_url":"https://api.github.com/users/cdibbs/received_events","type":"User","site_admin":false},"created_at":"2018-02-17T21:47:04Z","updated_at":"2018-02-17T21:47:04Z","author_association":"NONE","body":"I've added a project that demonstrates the bug.\r\n\r\nhttps://github.com/cdibbs/tsnode-alsatian-scrambled-coverage-issue\r\n\r\nIt's also possible this is a ts-node bug, but I am not familiar enough with the inner workings of nyc or ts-node to know for sure."}}
{"actor":{"display_login":"cdibbs"}}