Skip to content

Make coverage, like, really fast#30811

Merged
jonahwilliams merged 5 commits intoflutter:masterfrom
jonahwilliams:check_other_coverage
Apr 15, 2019
Merged

Make coverage, like, really fast#30811
jonahwilliams merged 5 commits intoflutter:masterfrom
jonahwilliams:check_other_coverage

Conversation

@jonahwilliams
Copy link
Contributor

Description

Applies changes described in go/better-dart-coverage

Related Issues

Fixes #23157

Tests

I added the following tests:

Replace this with a list of the tests that you added as part of this PR. A change in behaviour with no test covering it
will likely get reverted accidentally sooner or later. PRs must include tests for all changed/updated/fixed behaviors. See Test Coverage.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

return <String, dynamic>{'type': 'CodeCoverage', 'coverage': coverage};
}

List<int> _lineAndColumn(int position, List<dynamic> tokenPositions) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method could use some comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a description and a link to the vmservice documentation which describes the format

);
}
await Future.wait(futures);
final Map<Uri, Map<int, int>> hitMaps = <Uri, Map<int, int>>{};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help with readability you might split this code up into some more functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored this into a method for loading and a method for building

@goderbauer goderbauer added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 9, 2019
@jonahwilliams jonahwilliams marked this pull request as ready for review April 11, 2019 19:09
@jonahwilliams jonahwilliams requested a review from zanderso April 11, 2019 23:35
Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm w/ question.

for (Map<String, dynamic> range in sourceReport['ranges']) {
final Map<String, dynamic> coverage = range['coverage'];
final Map<String, dynamic> scriptRef = sourceReport['scripts'][range['scriptIndex']];
final Uri uri = Uri.parse(scriptRef['uri']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have to convert scriptRef['uri'] to a Uri object? It looks like all that's done with it is converting it back to a string in _toScriptCoverageJson.

@jonahwilliams
Copy link
Contributor Author

Build is currently green - the dashboard may be unable to update older PRs

@jonahwilliams jonahwilliams merged commit 301eaa8 into flutter:master Apr 15, 2019
@jonahwilliams jonahwilliams deleted the check_other_coverage branch April 15, 2019 15:59
jiahaog added a commit that referenced this pull request Jul 24, 2019
An optimization to the coverage collection speed was added in #30811. This commit further expands on it to parameterize the CoverageCollector with a custom predicate, allowing internal use cases to filter the RPC calls to the Dart VM based on scripts of interest to coverage collection.
johnsonmh pushed a commit to johnsonmh/flutter that referenced this pull request Jul 30, 2019
…#36774)

An optimization to the coverage collection speed was added in flutter#30811. This commit further expands on it to parameterize the CoverageCollector with a custom predicate, allowing internal use cases to filter the RPC calls to the Dart VM based on scripts of interest to coverage collection.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running unit tests with coverage enabled takes up to 10x times longer than without coverage

4 participants