tntim96 / JSCover

JSCover is a JavaScript Code Coverage Tool that measures line, branch and function coverage
GNU General Public License v2.0
399 stars 84 forks source link

report file jscoverage.html is abnormal #304

Closed lzf-bupt closed 3 years ago

lzf-bupt commented 3 years ago

Hello, when I use jscover-2.0.12 and execute the command "Java - jar target / dist / jscover-all.jar - WS -- document root = doc / example -- report dir = target", the coverage information can be displayed correctly, but the code coverage displayed in the jscoverage.html file exported to the target folder is always 0. Do you know how to solve this problem? image

lzf-bupt commented 3 years ago

The screenshot of the test process is like this image

tntim96 commented 3 years ago

This is probably a browser permissions issue, see the FAQ for information.

In short, Chrome needs to start with --allow-file-access-from-files. For FireFox set the privacy.file_unique_origin config option to false. Let me know what browser you're using and I'll see if it needs a similar security setting.

lzf-bupt commented 3 years ago

I use Google browser. I used your suggestion to start Google browser with the "chrome.exe --allow-file-access-from-files" command in the command line window, and then I used the "java -jar target/dist/JSCover-all.jar -ws --document-root=doc/example --report-dir=target" command. During the test, the code coverage information can be displayed correctly, but the code coverage is still 0 in the jscoverage.html file of the exported report.

tntim96 commented 3 years ago

Is an error displayed in the dev-tools console?

lzf-bupt commented 3 years ago

When I start Google browser (Figure 1) with the "- allow file access from files" command, it cannot enter‘ https://localhost:8080/jscoverage.html ’. But now other browsers, such as edge browser (Figure 2) and Lenovo browser(Figure 3) , can access it‘ https://localhost:8080/jscoverage.html ’Interface

------------------ 原始邮件 ------------------ 发件人: "tntim96/JSCover" @.>; 发送时间: 2021年8月15日(星期天) 晚上8:26 @.>; @.**@.>; 主题: Re: [tntim96/JSCover] report file jscoverage.html is abnormal (#304)

Is an error displayed in the dev-tools console?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

lzf-bupt commented 3 years ago

When I start Google browser with the "- allow file access from files" command and 'java -jar target/dist/JSCover-all.jar -ws --document-root=doc/example --report-dir=target', it can enter‘ https://localhost:8080/jscoverage.html ’, and sometimes it cannot enter ‘https://localhost:8080/jscoverage.html '.

lzf-bupt commented 3 years ago

I changed from Google browser to Firefox browser, and the reports exported after “setting the 'privacy.file_unique_origin' config option to false” can be opened normally with Google browser. Thank you