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

Add the ability to ignore lines from coverage depending on the comment #302

Merged
merged 5 commits into from
Jun 3, 2020
Merged

Conversation

pasindud
Copy link
Contributor

@pasindud pasindud commented Jun 2, 2020

Use // coverage:ignore-line to ignore one line.
Use // coverage:ignore-start and // coverage:ignore-end to ignore range of lines inclusive.
Use // coverage:ignore-file to ignore the whole file.

Use // coverage:ignore-line to ignore one line.
Use // coverage:ignore-start and // coverage:ignore-end to ignore range of lines inclusive.
Use // coverage:ignore-file to ignore the whole file.
@pasindud pasindud changed the title Add the ability to ignore lines depending on the comment Add the ability to ignore lines from coverage depending on the comment Jun 2, 2020
@grouma grouma self-requested a review June 3, 2020 02:14
Copy link
Member

@grouma grouma left a comment

Choose a reason for hiding this comment

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

We should have a CHANGELOG entry and rev the package version.

bin/format_coverage.dart Outdated Show resolved Hide resolved
@pasindud
Copy link
Contributor Author

pasindud commented Jun 3, 2020

Should we add a entry to README also about this ?

@grouma
Copy link
Member

grouma commented Jun 3, 2020

Should we add a entry to README also about this ?

Probably a good idea. Otherwise LGTM.

@grouma grouma merged commit 5142786 into dart-lang:master Jun 3, 2020
grouma added a commit that referenced this pull request Jun 4, 2020
grouma added a commit that referenced this pull request Jun 4, 2020
* Revert "Add the ability to ignore lines from coverage depending on the comment (#302)"

This reverts commit 5142786.

* fix changelog

* fix version
@elias8
Copy link

elias8 commented Dec 19, 2020

Is this available on the current stable which is 1.22.5?

@grouma
Copy link
Member

grouma commented Jan 5, 2021

This should be available in stable as it depends on version 14.1: https://github.com/flutter/flutter/blob/78910062997c3a836feee883712c241a5fd22983/packages/flutter_tools/pubspec.yaml#L17

@lukepighetti
Copy link

lukepighetti commented Jan 27, 2021

I'm on Flutter Channel dev, 1.26.0-8.0.pre and have // coverage:ignore-file at the top of a file and it's still showing up in code coverage reports. I'm generating coverage with flutter test --coverage

Is this known to work? Am I missing a configuration step?

Entire file

// coverage:ignore-file
import 'package:permission_handler/permission_handler.dart';
import 'package:permission_handler/permission_handler.dart' as permissionHandler
    show openAppSettings;

/// A mockable interface for `permission_handler` package.
class PermissionsService {
  /// Check the status of a specific [Permission]
  Future<PermissionStatus> status(Permission permission) {
    return permission.status;
  }

  /// Open the app settings.
  Future<bool> openAppSettings() {
    return permissionHandler.openAppSettings();
  }

  /// Request permissions for a single permission.
  Future<PermissionStatus> request(Permission permission) {
    return permission.request();
  }
}

@grouma
Copy link
Member

grouma commented Jan 28, 2021

@lukepighetti I tried to reproduce your issue and I'm unable to do so. I simply ran flutter test --coverage on the hello_world example within the Flutter repo. I can add and ignore files as expected.

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