qunitjs / node-qunit

QUnit runner for Node.js.
MIT License
172 stars 53 forks source link

Adding files match with paths argument into coverage list #114

Closed wanasit closed 9 years ago

wanasit commented 9 years ago

I discovered that:

In this PR, I make the files that match the paths parameter include in coverage report, which I think it could be useful. Please review.

kof commented 9 years ago

This is by design, why do you want to include anything else to the coverage report than the file you are testing?

wanasit commented 9 years ago

Your qunit, for example, are modulized into several files (in lib directory) which is linked to the main module -- testrunner.js. If I run integration tests on exported APIs of testrunner, I won't get the coverage checking on any other files (ex. coverage.js, log.js, generator.js) which account for a lot of logic.

In my case, I need to use the feature on my project to have coverage report on every file within src folder. (https://github.com/wanasit/chrono)

kof commented 9 years ago
  1. how are you running the tests? "qunit -c chrono:src/chrono.js -p src -t test-qunit/*.js --cov" ?
  2. how do you want to pass "paths"?
wanasit commented 9 years ago
  1. Yep. For the Node.js (build with Travis CI), I use npm test (qunit -c chrono:src/chrono.js -p src -t test-qunit/*.js --cov).
  2. I pass src folder into -p. With the change I made, qunit will put all the file that match the path (/src) into the coverage.

I think you may have a better approach. This PR is just to proposing my problem and the idea.

kof commented 9 years ago

Well, test-qunit/*.js is not gonna work ... :)

wanasit commented 9 years ago

Well.. it does work as expect. You can check the log output here: https://travis-ci.org/wanasit/chrono

kof commented 9 years ago

haha how that, I haven't used any minimatch implementation ....

kof commented 9 years ago

I am basically ok with passing additional paths to coverage, but we need to

wanasit commented 9 years ago

That looks better. And, it should be compatible with the normal --cov without params.

wanasit commented 9 years ago

And, what was your plan with with -p originally?

kof commented 9 years ago

-p don't see it used anywhere ....

wanasit commented 9 years ago

Let's close this PR for now. I will take your suggestion and send you a new one. You can also go ahead and implement it if you have time.

BTW. Happy new year.