{"action":"created","issue":{"url":"https://api.github.com/repos/istanbuljs/nyc/issues/673","repository_url":"https://api.github.com/repos/istanbuljs/nyc","labels_url":"https://api.github.com/repos/istanbuljs/nyc/issues/673/labels{/name}","comments_url":"https://api.github.com/repos/istanbuljs/nyc/issues/673/comments","events_url":"https://api.github.com/repos/istanbuljs/nyc/issues/673/events","html_url":"https://github.com/istanbuljs/nyc/issues/673","id":256460261,"number":673,"title":"Do I misunderstand how you glob? If not, I'm losing test cases and I don't know why","user":{"login":"StoneCypher","id":77482,"avatar_url":"https://avatars0.githubusercontent.com/u/77482?v=4","gravatar_id":"","url":"https://api.github.com/users/StoneCypher","html_url":"https://github.com/StoneCypher","followers_url":"https://api.github.com/users/StoneCypher/followers","following_url":"https://api.github.com/users/StoneCypher/following{/other_user}","gists_url":"https://api.github.com/users/StoneCypher/gists{/gist_id}","starred_url":"https://api.github.com/users/StoneCypher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoneCypher/subscriptions","organizations_url":"https://api.github.com/users/StoneCypher/orgs","repos_url":"https://api.github.com/users/StoneCypher/repos","events_url":"https://api.github.com/users/StoneCypher/events{/privacy}","received_events_url":"https://api.github.com/users/StoneCypher/received_events","type":"User","site_admin":false},"labels":[{"id":694301415,"url":"https://api.github.com/repos/istanbuljs/nyc/labels/needs-investigation","name":"needs-investigation","color":"fef2c0","default":false},{"id":652821867,"url":"https://api.github.com/repos/istanbuljs/nyc/labels/triaged","name":"triaged","color":"bfdadc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-09T19:23:41Z","updated_at":"2017-09-16T16:03:27Z","closed_at":null,"author_association":"NONE","body":"## Expected Behavior\r\nSmall-medium (430 cases in ~20 files) testset on library.  100% coverage.\r\n\r\nTried to switch from shallow match for test names run to deep match.  No change, as expected.  \r\n\r\n```\r\n> jssm@5.8.0 test /Users/johnhaugeland/projects/jssm\r\n> nyc ava src/js/tests/**/*.js\r\n\r\n\r\n  430 passed\r\n----------------------------|----------|----------|----------|----------|----------------|\r\nFile                        |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |\r\n----------------------------|----------|----------|----------|----------|----------------|\r\nAll files                   |      100 |      100 |      100 |      100 |                |\r\n js                         |      100 |      100 |      100 |      100 |                |\r\n  jssm-util.js              |      100 |      100 |      100 |      100 |                |\r\n  jssm.js                   |      100 |      100 |      100 |      100 |                |\r\n js/tests                   |      100 |      100 |      100 |      100 |                |\r\n  array_transitions.js      |      100 |      100 |      100 |      100 |                |\r\n  arrow.js                  |      100 |      100 |      100 |      100 |                |\r\n  comment.js                |      100 |      100 |      100 |      100 |                |\r\n  compile.js                |      100 |      100 |      100 |      100 |                |\r\n  forced transitions.js     |      100 |      100 |      100 |      100 |                |\r\n  general.js                |      100 |      100 |      100 |      100 |                |\r\n  graph node lists.js       |      100 |      100 |      100 |      100 |                |\r\n  histo.js                  |      100 |      100 |      100 |      100 |                |\r\n  layout.js                 |      100 |      100 |      100 |      100 |                |\r\n  machine_attributes.js     |      100 |      100 |      100 |      100 |                |\r\n  machine_name.js           |      100 |      100 |      100 |      100 |                |\r\n  parse actions.js          |      100 |      100 |      100 |      100 |                |\r\n  parse.js                  |      100 |      100 |      100 |      100 |                |\r\n  sample_select.js          |      100 |      100 |      100 |      100 |                |\r\n  seq.js                    |      100 |      100 |      100 |      100 |                |\r\n  sm_tag.js                 |      100 |      100 |      100 |      100 |                |\r\n  stop light.js             |      100 |      100 |      100 |      100 |                |\r\n  weighted_histo_key.js     |      100 |      100 |      100 |      100 |                |\r\n  weighted_rand_select.js   |      100 |      100 |      100 |      100 |                |\r\n  weighted_sample_select.js |      100 |      100 |      100 |      100 |                |\r\n----------------------------|----------|----------|----------|----------|----------------|\r\n```\r\n\r\n## Observed Behavior\r\nMove one test case into subdirectory.  Expect no change.\r\n\r\nOnly the test set now in the subdirectory is actually run.\r\n\r\n```\r\nJohn-Haugeland:tests johnhaugeland$ mkdir util\r\nJohn-Haugeland:tests johnhaugeland$ mv histo.js util/\r\n\r\n(in editor, twiddle histo.js reference from ../../../lib to ../../../../lib)\r\n\r\nJohn-Haugeland:tests johnhaugeland$ npm run test\r\n\r\n> jssm@5.8.0 test /Users/johnhaugeland/projects/jssm\r\n> nyc ava src/js/tests/**/*.js\r\n\r\n\r\n  4 passed\r\n---------------|----------|----------|----------|----------|----------------|\r\nFile           |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |\r\n---------------|----------|----------|----------|----------|----------------|\r\nAll files      |     7.07 |     1.01 |    15.56 |     6.15 |                |\r\n js            |      3.5 |     1.01 |        5 |     3.56 |                |\r\n  jssm-util.js |    24.14 |    16.67 |    16.67 |    28.57 |... 21,31,47,55 |\r\n  jssm.js      |     1.17 |        0 |        0 |     1.29 |... 821,828,835 |\r\n js/tests/util |      100 |      100 |      100 |      100 |                |\r\n  histo.js     |      100 |      100 |      100 |      100 |                |\r\n---------------|----------|----------|----------|----------|----------------|\r\nJohn-Haugeland:tests johnhaugeland$ \r\n```\r\n\r\n## Bonus Points! Code (or Repository) that Reproduces Issue\r\n\r\nThe repo that exhibits this behavior is [jssm](https://github.com/StoneCypher/jssm).  In this repo, `nyc` runs `ava` from the command `npm run test`, which executes `nyc ava src/js/tests/**/*.js` from [line 10 of package.json](https://github.com/StoneCypher/jssm/blob/master/package.json#L10).\r\n\r\nA branch that has repro behavior [lives here](https://github.com/StoneCypher/jssm/tree/BrokenTestBehavior).\r\n\r\nIf you would like to manually repro from `master`:\r\n\r\n1. Pull the `node` project [jssm](https://github.com/StoneCypher/jssm) or install from npm with `npm install jssm`\r\n1. Go to where you pulled or installed `jssm`\r\n1. Change the test runner script on [line 10 of package.json](https://github.com/StoneCypher/jssm/blob/master/package.json#L10) from `nyc ava src/js/tests/*.js` to `nyc ava src/js/tests/**/*.js` (the difference being the `/**` before the filename)\r\n1. Create a subdirectory in `src/js/tests/` with your choice of name (I used `util`)\r\n1. Move any test set of your choice into the subdirectory (I used `histo.js`)\r\n1. Modify the moved test set's `require` of the built library from `const jssm = require('../../../build/jssm.es5.js');` to `const jssm = require('../../../../build/jssm.es5.js');` (that is, from three `../` to four) to reflect its new location on disk\r\n\r\nYou should now see the test rig focus solely on the test you moved into the subdirectory, which will continue to pass, and ignore the tests in the directory above it, causing coverage to drop to 7%.\r\n\r\n## Forensic Information\r\n\r\n**Operating System:** MacOS Sierra 10.12.4 .\r\n**Environment Information:** [gisted](https://gist.github.com/StoneCypher/258adda3c5dcf47b97dbc6eacd2dfd57)"},"comment":{"url":"https://api.github.com/repos/istanbuljs/nyc/issues/comments/329977396","html_url":"https://github.com/istanbuljs/nyc/issues/673#issuecomment-329977396","issue_url":"https://api.github.com/repos/istanbuljs/nyc/issues/673","id":329977396,"user":{"login":"bcoe","id":194609,"avatar_url":"https://avatars3.githubusercontent.com/u/194609?v=4","gravatar_id":"","url":"https://api.github.com/users/bcoe","html_url":"https://github.com/bcoe","followers_url":"https://api.github.com/users/bcoe/followers","following_url":"https://api.github.com/users/bcoe/following{/other_user}","gists_url":"https://api.github.com/users/bcoe/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoe/subscriptions","organizations_url":"https://api.github.com/users/bcoe/orgs","repos_url":"https://api.github.com/users/bcoe/repos","events_url":"https://api.github.com/users/bcoe/events{/privacy}","received_events_url":"https://api.github.com/users/bcoe/received_events","type":"User","site_admin":false},"created_at":"2017-09-16T16:03:27Z","updated_at":"2017-09-16T16:03:27Z","author_association":"OWNER","body":"@StoneCypher the appropriate tests run with that glob in ava, but are failing to show up in coverage report?\r\n\r\nPerhaps see if you can reproduce with a failing test in the matching library itself:\r\n\r\nhttps://github.com/istanbuljs/istanbuljs/tree/master/packages/test-exclude"}}
{"actor":{"display_login":"bcoe"}}