Closed jonnyreeves closed 10 years ago
Yep. That actually confuses a lot of people & is always a foundation for the "Is it a bug or a feature" discussion. First of all, the Test Runner only takes the files into account that are actually used by the test, so, if you test your concatenated file, it picks that up.
I personally see this as "a feature" because you are definitely only getting the result of the files you actually test against. So, to answer your question, you do need to have a "per file" configuration & test in grunt. If someone will come up with a PR that makes "a fix" for this optionally available, I will definitely get it in, but I have no intention to change the behaviour on my own.
Cheers Sebastian
Thanks for the fantastic library; I had a question around getting coverage reports for build that use the grunt-concat plugin to concatenate several source files (or indeed, those projects that make use of browserify / require a pre-build step to generate valid JS).
I am using the following Gruntfile:
And my
qunit-test-runner.html
file has the following<head>
to include the sources:When I execute my build, I can see the QUnit assertions passing, however the coverage plugin does not pick up on my instrumented files, ie:
If I modify my Gruntfile to point the coverage
src
at the concatenated output, I do get a valid coverage report, ie:However the HTML report now only shows a single file (
concatenated.js
) which is hard to consume / read, especially with a large project.Is there a trick for mapping the coverage report back to the individual JS files, or do I actually need to make my QUnit Test Runner use the actual sources instead of the concatenated JS sources?
Thanks again Jonny.