New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(coverage): expose raw v8 coverage #976
Conversation
25defc5
to
27999cf
Compare
@@ -82,7 +99,7 @@ class JSCoverage { | |||
this._resetOnNavigation = resetOnNavigation; | |||
this._reportAnonymousScripts = reportAnonymousScripts; | |||
this._enabled = true; | |||
this._scriptURLs.clear(); | |||
this._scriptIds.clear(); | |||
this._scriptSources.clear(); | |||
this._eventListeners = [ | |||
helper.addEventListener(this._client, 'Debugger.scriptParsed', this._onScriptParsed.bind(this)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I've tested a simple hack with raw coverage and it works nicely, apart from:
5 lines down from this we have:
this._client.send('Profiler.startPreciseCoverage', {callCount: false, detailed: true}),
I can get a really nice coverage report with istanbul if we get callCount info:
this._client.send('Profiler.startPreciseCoverage', {callCount: true, detailed: true}),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, counting calls now.
df2ba5a
to
658a16f
Compare
src/chromium/crCoverage.ts
Outdated
if (!ranges) { | ||
ranges = []; | ||
styleSheetIdToCoverage.set(entry.styleSheetId, ranges); | ||
const entries = new Map<string, CSSCoverageEntry>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are scary: I'm not sure CSS coverage actually yields disjoint ranges (and IIRC we had some problems here).
Can we keep the old codepath for CSS coverage?
658a16f
to
3cd776e
Compare
@@ -11,6 +11,6 @@ | |||
"end": 433 | |||
} | |||
], | |||
"text": "\n@charset \"utf-8\";\n@namespace svg url(http://www.w3.org/2000/svg);\n@font-face {\n font-family: \"Example Font\";\n src: url(\"./Dosis-Regular.ttf\");\n}\n\n#fluffy {\n border: 1px solid black;\n z-index: 1;\n /* -webkit-disabled-property: rgb(1, 2, 3) */\n -lol-cats: \"dogs\" /* non-existing property */\n}\n\n@media (min-width: 1px) {\n span {\n -webkit-border-radius: 10px;\n font-family: \"Example Font\";\n animation: 1s identifier;\n }\n}\n" | |||
"source": "\n@charset \"utf-8\";\n@namespace svg url(http://www.w3.org/2000/svg);\n@font-face {\n font-family: \"Example Font\";\n src: url(\"./Dosis-Regular.ttf\");\n}\n\n#fluffy {\n border: 1px solid black;\n z-index: 1;\n /* -webkit-disabled-property: rgb(1, 2, 3) */\n -lol-cats: \"dogs\" /* non-existing property */\n}\n\n@media (min-width: 1px) {\n span {\n -webkit-border-radius: 10px;\n font-family: \"Example Font\";\n animation: 1s identifier;\n }\n}\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we keep "text"?
b7c5073
to
1fbef01
Compare
1fbef01
to
754455b
Compare
Fixes #955