最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Confused about how to use JScover - Stack Overflow

programmeradmin0浏览0评论

I need to check the test coverage in my Jscript application. I am using Qunit as unit test framework. I cannot make Jscover works properly. I haven't understood how should I use it, which mand I should issue and which directories I have to specify in the path.

This is the structure of my file system :

JSON/ 
css/
html/
images/  
js/
test/
index.html  

The code I want to test is in the js folder, while the qunit test are in the test folder.

I need to check the test coverage in my Jscript application. I am using Qunit as unit test framework. I cannot make Jscover works properly. I haven't understood how should I use it, which mand I should issue and which directories I have to specify in the path.

This is the structure of my file system :

JSON/ 
css/
html/
images/  
js/
test/
index.html  

The code I want to test is in the js folder, while the qunit test are in the test folder.

Share Improve this question edited Feb 13, 2013 at 23:26 Ja͢ck 174k39 gold badges267 silver badges314 bronze badges asked Feb 13, 2013 at 23:23 Giuseppe PesGiuseppe Pes 7,9184 gold badges54 silver badges91 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

You can post this as a question at https://github./tntim96/JSCover/issues, but will try to answer here...

If you run the tests by pointing your browser at the 'index.html' file, and assuming that is in the directory 'c:/your-test-directory', you can run it via the server mode. For example:

java -jar target/dist/JSCover.jar -ws --branch --document-root=c:/your-test-directory --report-dir=target --no-instrument=test --no-instrument=js/lib

I've added '--no-instrument=js/lib' to illustrate how to exclude 3rd party libraries, such as JQuery, from instrumentation.

Then point your browser at http://localhost:8080/jscoverage.html?/index.html

There is more information in the manual too. Let me know how you go.

发布评论

评论列表(0)

  1. 暂无评论