-
Notifications
You must be signed in to change notification settings - Fork 218
Chrome coverage support #1155
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
Chrome coverage support #1155
Conversation
|
||
import '../executable_settings.dart'; | ||
import 'browser.dart'; | ||
import 'default_settings.dart'; | ||
|
||
// TODO(nweiz): move this into its own package? |
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.
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.
Are we using it? Should we file an issue to migrate to that package?
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.
@@ -73,6 +82,8 @@ class Chrome extends Browser { | |||
if (port != null) { | |||
remoteDebuggerCompleter.complete( | |||
getRemoteDebuggerUrl(Uri.parse('http://localhost:$port'))); | |||
|
|||
connectionCompleter.complete(await _connect(process, port, idToUrl)); |
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.
I don't think this await
is necessary, Completer.complete
takes a FutureOr
.
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.
Done.
@@ -3,6 +3,8 @@ | |||
* Bump minimum SDK to `2.4.0` for safer usage of for-loop elements. | |||
* Deprecate `PhantomJS` and provide warning when used. Support for `PhantomJS` | |||
will be removed in version `2.0.0`. | |||
* Support coverage collection for the Chrome platform. See `README.md` for usage |
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.
1.12.0 since this is a new feature 🎉
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.
Done.
message, gatherCoverage: () async { | ||
var browser = _browser; | ||
if (browser is Chrome) return browser.gatherCoverage(); | ||
return {}; |
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.
should we warn here or anything?
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.
This will produce an empty result which is consistent with the current behavior. I might follow up with a PR that warns at the time of arg parsing.
var script = _idToUrl[scriptId]; | ||
if (script == null) return null; | ||
var uri = Uri.parse(script); | ||
var path = p.join( |
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.
nit: you could do
var path = p.joinAll([
...uri.pathSegments.sublist(1, uri.pathSegments.length - 1),
sourceUrl,
]);
What a nice surprise for a Friday afternoon! Thank you! |
We're pretty excited to use this .. will there be a 1.12 release with coverage soon? |
Likely next week (busy this week traveling for work). I need to make sure this solution scales for our internal use and so far it has been extremely promising. I have uncovered an issue in which invalid source maps can cause a crash. Once I fix that up I'll publish a new version of Glad you folks are excited :D |
Support coverage collection for the Chrome platform. Coverage information is output to
.chrome.json
in a format suitable for consumption bypackage:coverage
.Closes #36