Styles coverage should exclude newlines/whitespace in case of 100% coverage
Reported by
karanjth...@gmail.com,
Oct 18 2017
|
||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3241.0 Safari/537.36 Steps to reproduce the problem: 1. Go to https://zealous-powder.surge.sh 2. Enable coverage 3. Click on the button in the page 4. The coverage for the css file says 1 unused bytes, which is a newline. What is the expected behavior? I believe it would be a good idea to skip these bytes in the eventual calculation reported so that end users can calculate/consume these stats using headless chrome and integrate CI steps for certain coverage %age. What went wrong? For a stylesheet, which has 100% valid coverage, the unused bytes don't drop down to zero because of new lines. The reason this doesn't happen for JS files is that used/unused function ranges are available during calculation so you can count all ranges with count=0 and get the unused stats. In case of styles, the coverage only has ruleusage for used rules. So its hard to get the calculation right coz you don't know if the unused bytes are newlines or other unused rules. Hope that makes sense. Happy to provide details if something is unclear. Did this work before? N/A Chrome version: 64.0.3241.0 Channel: canary OS Version: OS X 10.12.6 Flash Version:
,
Oct 18 2017
This is actually a feature request but I couldn't figure out how to submit the issue with Type: Feature.
,
Oct 23 2017
This talks about two different things: - Coverage panel in DevTools shows 1 unused byte. Technically, that byte is really unused. Since our intention is to show how many bytes you can safely strip away, it is correct. - Protocol data (for stats in headless/headful mode) is precise and counts new line character as unused. Any tool which wants to ignore newlines is free to do so - requesting CSS source through CSS.getStyleSheetText should help. Please comment here if I misunderstood anything.
,
Oct 25 2017
Hi, thanks for the clarification. If you check the coverage (on button click) for index.js and style.css, you will find that only style.css shows 1 unused byte whereas index.js shows 0 unused byte. Whereas in reality it does have 1 unused byte after the `coverMore` function declaraction. Since it is your intention is to show how many bytes a user can safely strip away, shouldn't this logic also apply to JS file coverage? Or am I misunderstanding something really obvious? Would love to learn more. |
||
►
Sign in to add a comment |
||
Comment 1 Deleted