javascript - phantomjs-node + lab (test utility from hapijs) + test coverage -
javascript - phantomjs-node + lab (test utility from hapijs) + test coverage -
i using phantomjs-node , is, unfortunately, not playing lab's test coverage stuff. when run lab -t 100, trying inject __$$labcov function passed page.evalute(). however, function not executed in context of code in appears. executed in context of phantom browser.
so, in code beingness tested, if have in midst of phantomjs code:
page.evaluate( function () { homecoming 'foo'; }, function (result) { // result here ph.exit(); } ); in sec function, result should string "foo". , that's happens when run code. if run via lab -t 100, null , "phantom stdout: referenceerror: can't find variable: __$$labcov".
is there way tell lab, "hey, know 1 line looks code yo u want create sure gets run, really, don't worry little function here, it's not you."?
alternately, there way can access __$$labcov can create available sandboxed function? phantom let's this:
page.evaluate( function (__$$labcov) { homecoming 'foo'; }, function (result) { // result here ph.exit(); }, __$$labcov ); but doesn't work because don't have access __$$labcov...
lab has little undocumented feature can mark section of code coverage exclusion. used lab coverage code (since lab uses lab test lab). surround code $lab:coverage:off$ , $lab:coverage:on$.
https://github.com/hapijs/lab/blob/master/lib/coverage.js#l240-l261
javascript phantomjs hapijs
Comments
Post a Comment