buster-coverage with buster-amd (requirejs)

42 views
Skip to first unread message

Roy Sindre Norangshol

unread,
Jul 23, 2013, 3:50:53 AM7/23/13
to buster...@googlegroups.com, roy.s...@norangshol.no
Hey

I've tried patching buster-coverage to get it to successfully run together with
buster-amd, tho I have some troubles writing tests so I can publish my hacks
for the community.

1) Source files when using buster-amd is bundled in busterconfig.resources, so
they are available over the test server and not included in the HTML-bootstrap
with <script src> tags, as modules that should be loaded with requirejs should
be loaded using the require([]) call.

2) buster-coverage needs to know how it should fetch these sources when using
requirejs, so add isModulePattern to buster-coverage constructor.

3) hook a new signal for buster-configuration at line[1] for "resources" and
and if-clause for remapping section from "resources -> resourcesConfig" at
line[2] since �load:resources� is used for concatinating every resource....
wat.

4) now, ideally we don't want the thing mentioned in 2), ideally we want to
access which loaded extentions are loaded and just use that .. but there's no
way to load that either, maybe by adding yet another resourceSet with
extentions? Because I don't see any way to simply access buster's current
config in a test case as read only values.

That's the wiring needed to make it work at least..

One thing tho, the buster-coverage isn't actually reporting coverage as it
should. It's only instrumenting files which has tests associated with em, and
not all available source code which kinda makes the coverage report a nice lie.

This is an easy fix and I also know how to fix it, _BUT_ before I can continue
on my quest someone should help me to figure out how to get my test[3] running
so I could test the extension.js runTest method[4] so the result[5] actually
contains the proper {data: "evaluated Instrumented Code And Not Just The
Instrumented string not being evaluted ...", client: "not import, a spy should
be fine}

[1] https://github.com/busterjs/buster-configuration/blob/master/lib/group.js#L153
[2] https://github.com/busterjs/buster-configuration/blob/master/lib/group.js#L135

[3] https://github.com/norrs/buster-coverage/blob/unittests/test/buster-coverage-test.js#L106
[4] https://github.com/norrs/buster-coverage/blob/master/lib/extension.js#L48
[5] https://github.com/norrs/buster-coverage/blob/master/lib/extension.js#L56

NB: Please CC me as I'm not subscribed to the mailing list!
--
Roy Sindre Norangshol
roy.s...@norangshol.no
http://www.roysindre.no
Reply all
Reply to author
Forward
0 new messages