alex-seville / blanket

blanket.js is a simple code coverage library for javascript. Designed to be easy to install and use, for both browser and nodejs.
http://blanketjs.org
Other
1.4k stars 177 forks source link

How to specify what AMD modules to instrument? #325

Open evil-shrike opened 11 years ago

evil-shrike commented 11 years ago

I want to use Blanket with RequireJs-based project. I created such runner:

<script type="text/javascript" src="client/vendor/qunit.js"></script>
<script type="text/javascript">
       QUnit.config.autostart = false;
</script>
<script type="text/javascript" src="client/vendor/require.js" data-main="client/tests-main.js"></script>
<script  src="bower_components/blanket/dist/qunit/blanket.min.js" data-cover-only="tests-main" data-cover-flags="debug"></script>

As you can see data-cover-only refefs to rjs's main file. Here's console log:

BLANKET-Attempting instrument of:client/tests-main.js blanket.min.js:1
BLANKET-Instrumented file:  client/tests-main.js blanket.min.js:1
BLANKET-instrument of:client/tests-main.js was successfull. blanket.min.js:1
BLANKET-Loading (without instrumenting) the file:client/fixtures/some-my-test.js blanket.min.js:1

So main file (entry point) was instarumented but all other tests (which it loads) were not. How to instrument all (or some of them) modules loaded as AMD?

Also where all data-* attributes are described (can't find any docs on them)?

emmenko commented 11 years ago

I'm interested in this answer as well.

alex-seville commented 11 years ago

I'm not sure that Blanket has been tested using the data-main loader technique. Right now there isn't a full listing of all the data-* attributes. I started one on another branch but haven't had time to finish it yet.