Closed davestevens closed 9 years ago
:+1:
:+1:
Given that I'm not a fan of requireJS, I won't be trying to figure this out. However, I'm willing to provide the information needed while someone attempts it.
First things first.. when you have instrumenting enabled, can you get an instrumented file and does calling a method in that file change the coverage information? Removing teaspoon from the equation, I would suggest using istanbul directly for this.
Second thing.. I suspect that RequireJS simply doesn't work when instrumented without some work. Instrumenting for coverage reports literally rewrites your js files so they're entirely unreadable. A good way to check this is to run one of your files through istanbul to see the output.. then run that file and see if you have access to the instrumented data. This is what I did when I added coverage.
I'm close to getting this working. It worked in 0.7.8 but 0.8.0 broke it. All that is needed is to get the &instrument=1 query string added to the JS files included in _boot_require_js.html.erb via <%= javascript_include_tag @suite.helper %>
. I assume bringing back the javascript_include_tag_for_teaspoon
method for that partial will do the trick.
Once I get that working I'll submit a pull request.
This is sort of in the works, but we have to figure out how best to do it.. check #277 if you want to track that conversation.
Thanks for getting back about this, I've just made a pull request #315 which seems to allow requirejs to be used along with the coverage.
I've been trying to get Teaspoon to work with both RequireJS and Coverage.
I can get both working independently, but it seems the what i switch the
boot_partial
toboot_require_js
and try and run the specs with coverage the specs run but the coverage coming back onresult
inlib/teaspoon/runner.rb
is alwaysnil
.I tried to have a look into it and it seems that the
add?
method inTeaspoon::Instrumentation
never returns true when using RequireJS so no files are being marked for coverage.Looking at
asset_url
inlib/teaspoon/suite.rb
theasset_url
is being appended with?instrument=1
for my js files.Have you had any problems with this before? or are you able to point me in the right direction?