gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

Code coverage of tomcat deployed web app #419

Open konopiux opened 9 years ago

konopiux commented 9 years ago

Hello, I have web app on tomcat written in JS. I am testing it with casperjs. Is it possible to get coverage of it with istanbul. I tried to run Istanbul on nodejs, and hookup sources of my project. then send POST requests to it from casperJS: { casper.evaluate(function () { var xmlhttp = new XMLHttpRequest(); xmlhttp.open('POST', '/coverage/client', true); xmlhttp.setRequestHeader('Content-Type', 'application/json'); xmlhttp.send(JSON.stringify(window.coverage)); });} but window.__coverage__ is undefined.

Can someone give advice how to get coverage in my situation.

jay4github commented 7 years ago

try xmlhttp.send(JSON.stringify("window.__coverage__"));?