Skip to content
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

parseChromeCoverage #281

Merged
merged 6 commits into from
Jan 24, 2020
Merged

parseChromeCoverage #281

merged 6 commits into from
Jan 24, 2020

Conversation

grouma
Copy link
Member

@grouma grouma commented Jan 24, 2020

Towards dart-lang/test#36

Add parseChromeCoverage method to be used by package:test and internal tools. This method returns a hit-map based Dart report suitable for consumption by package:coverage to produce LCOV reports.

@coveralls
Copy link

coveralls commented Jan 24, 2020

Coverage Status

Coverage increased (+2.2%) to 87.819% when pulling d78ecfb on chrome-coverage into 5880488 on master.

@cbracken
Copy link
Member

Exciting! Will take a look today!

lib/src/chrome.dart Show resolved Hide resolved
final sourceUrl = mapping.urls[columnEntry.sourceUrlId];

// Ignore coverage information for the SDK.
if (sourceUrl.startsWith('org-dartlang-sdk:')) continue;
Copy link
Member

Choose a reason for hiding this comment

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

How stable is this? Where is it defined?

Copy link
Member Author

Choose a reason for hiding this comment

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

It comes from the SDK. I don't believe there is a way to programatically consume this value. We have similar logic in package:dwds.

lib/src/chrome.dart Show resolved Hide resolved
final allCoverage = <Map<String, dynamic>>[];
coverageHitMaps.forEach((uri, hitMap) {
allCoverage.add(toScriptCoverageJson(uri, hitMap));
});
Copy link
Member

Choose a reason for hiding this comment

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

[optional]

final allCoverage = [
  for(var hitMap in coverageHitMaps.entries)
    toScriptCoverageJson(hitMap.key, hitMap.value),
];

Copy link
Member Author

Choose a reason for hiding this comment

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

The SDK constraint is wide on this package so I don't believe we can use this feature yet.

range['count'] > 0,
));
}
}
Copy link
Member

Choose a reason for hiding this comment

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

[optional]

  return [
    for (Map<String, dynamic> functions in entry['functions'])
      for (Map<String, dynamic> range in functions['ranges'])
        _CoverageInfo(
          range['startOffset'],
          range['endOffset'],
          range['count'] > 0,
        ),
  ];

Copy link
Member Author

Choose a reason for hiding this comment

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

See above comment.

11: 1,
13: 1,
14: 1,
15: 1,
Copy link
Member

Choose a reason for hiding this comment

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

[nit] Would this be shorter without a trailing comma?

Copy link
Member Author

Choose a reason for hiding this comment

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

No difference.

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

@@ -0,0 +1,154 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
Copy link
Member

Choose a reason for hiding this comment

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

Not sure how this is done on the Dart team, but the general policy we use for Flutter is to use a single year for all files (in our case the earliest date we had in any of them, which was 2013). We used to use a policy that new files got the current year, old files preserved their headers, but that changed a few years back.

If current-year is still the right approach for Dart packages, then LGTM. Otherwise we should probably (in a separate PR), set these all consistently to 2013 in this repo, which is the earliest date I see in our headers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Most other packages I touch follow the current-year pattern.


@override
int get hashCode => hash2(line, column);
@override
Copy link
Member

Choose a reason for hiding this comment

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

nit: add a blank line before the @override.

@grouma grouma merged commit ac28541 into master Jan 24, 2020
@grouma grouma deleted the chrome-coverage branch January 24, 2020 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants