Patches and Improvements for jscoverage-0.5
Posted: 2010-08-05 1:05 pm
Hello!
The last few days I've begun using jscoverage to improve my application tests.
Finally it works really good after some problems and some improvements in the code.
I figured out to get the jscoverage-server to work using the proxy option.
Here are some possible improvements I could imagine:
Kind regards,
Klaus.
The last few days I've begun using jscoverage to improve my application tests.
Finally it works really good after some problems and some improvements in the code.
I figured out to get the jscoverage-server to work using the proxy option.
Here are some possible improvements I could imagine:
- It would also be nice to have the possibility to use pre-instrumented JS-code for the jscoverage-server.
- Maybe a "report-finishing"-function, which processes the JSON-file and writes simple-HTML code for the final result data would help to make the report-results faster (especially when you have big JS-files resulting in a huge JSON-file) ... because after the tests have finished / or the server has shutdown the coverage data will not be changed any more - so than the data can be optimized for viewing the results.
Code: Select all
diff -r jscoverage-0.5/jscoverage.js jscoverage-0.5.patched/jscoverage.js
334,335c334
< var response = request.responseText;
< if (response === '') {
---
> if (request.responseText === '') {
338c337,342
< var json = eval('(' + response + ')');
---
> var json;
> if (JSON && JSON.parse && typeof JSON.parse === "function") {
> json = JSON.parse(request.responseText);
> } else {
> json = eval('(' + response + ')');
> }
diff -r jscoverage-0.5/jscoverage-server.c jscoverage-0.5.patched/jscoverage-server.c
1280c1280
< HTTPConnection * connection = HTTPConnection_new_client(ip_address, numeric_port);
---
> HTTPConnection * connection = HTTPConnection_new_client("127.0.0.1", numeric_port);
Klaus.