-
Notifications
You must be signed in to change notification settings - Fork 49
Implemented --fail-under flag #(514) #2051
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
base: main
Are you sure you want to change the base?
Conversation
PR Health
Breaking changes
|
Package | Change | Current Version | New Version | Needed Version | Looking good? |
---|---|---|---|---|---|
coverage | Non-Breaking | 1.12.0 | 1.12.0-wip | 1.13.0 Got "1.12.0-wip" expected >= "1.13.0" (non-breaking changes) |
This check can be disabled by tagging the PR with skip-breaking-check
.
Changelog Entry ✔️
Package | Changed Files |
---|
Changes to files need to be accounted for in their respective changelogs.
Coverage ⚠️
File | Coverage |
---|---|
pkgs/coverage/bin/format_coverage.dart | 💔 45 % ⬇️ 7 % |
pkgs/coverage/lib/src/collect.dart | 💔 86 % ⬇️ 1 % |
pkgs/coverage/lib/src/formatter.dart | 💔 82 % ⬇️ 15 % |
pkgs/coverage/lib/src/resolver.dart | 💚 96 % ⬆️ 0 % |
This check for test coverage is informational (issues shown here will not fail the PR).
This check can be disabled by tagging the PR with skip-coverage-check
.
API leaks ✔️
The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
Package | Leaked API symbols |
---|
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files |
---|
no missing headers |
All source files should start with a license header.
Unrelated files missing license headers
Files |
---|
pkgs/bazel_worker/benchmark/benchmark.dart |
pkgs/bazel_worker/example/client.dart |
pkgs/bazel_worker/example/worker.dart |
pkgs/benchmark_harness/integration_test/perf_benchmark_test.dart |
pkgs/boolean_selector/example/example.dart |
pkgs/clock/lib/clock.dart |
pkgs/clock/lib/src/clock.dart |
pkgs/clock/lib/src/default.dart |
pkgs/clock/lib/src/stopwatch.dart |
pkgs/clock/lib/src/utils.dart |
pkgs/clock/test/clock_test.dart |
pkgs/clock/test/default_test.dart |
pkgs/clock/test/stopwatch_test.dart |
pkgs/clock/test/utils.dart |
pkgs/coverage/lib/src/coverage_options.dart |
pkgs/coverage/test/collect_coverage_config_test.dart |
pkgs/coverage/test/config_file_locator_test.dart |
pkgs/html/example/main.dart |
pkgs/html/lib/dom.dart |
pkgs/html/lib/dom_parsing.dart |
pkgs/html/lib/html_escape.dart |
pkgs/html/lib/parser.dart |
pkgs/html/lib/src/constants.dart |
pkgs/html/lib/src/encoding_parser.dart |
pkgs/html/lib/src/html_input_stream.dart |
pkgs/html/lib/src/list_proxy.dart |
pkgs/html/lib/src/query_selector.dart |
pkgs/html/lib/src/token.dart |
pkgs/html/lib/src/tokenizer.dart |
pkgs/html/lib/src/treebuilder.dart |
pkgs/html/lib/src/utils.dart |
pkgs/html/test/dom_test.dart |
pkgs/html/test/parser_feature_test.dart |
pkgs/html/test/parser_test.dart |
pkgs/html/test/query_selector_test.dart |
pkgs/html/test/selectors/level1_baseline_test.dart |
pkgs/html/test/selectors/level1_lib.dart |
pkgs/html/test/selectors/selectors.dart |
pkgs/html/test/support.dart |
pkgs/html/test/tokenizer_test.dart |
pkgs/pubspec_parse/test/git_uri_test.dart |
pkgs/stack_trace/example/example.dart |
pkgs/watcher/test/custom_watcher_factory_test.dart |
pkgs/yaml_edit/example/example.dart |
Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.
I was trying to do this implementation, but got stuck in the last.
(First approach):-
This is all what I did:
--fail-under
flag toArgParser
( parsing CLI arguments) this function is present inbin/format_coverage.dart
--fail-under
after parsing.failUnderThreshold
so that it can be accessed later. then passedfailUnderThreshold
inparseArgs
return statement.formatLcov
function, which is present inlib/src/formatter.dart
and added this logic to check fail-under:Testing:
dart test --coverage=coverage
and gathered coverage data. data was successfully gathered with all tests passed.dart run coverage:format_coverage -i coverage/test -o coverage/coverage.json --report-on=lib
--fail-under
by running:dart bin/format_coverage.dart -i coverage/coverage.json --fail-under=90
Result:
Conclusion:
Not able to find the cause for which output is empty.
Possible cause:
As the fail under check is one file (
lib/src/formatter.dart
) and the parser is in another file (bin/format_coverage.dart
), it is not getting executed when I run:dart bin/format_coverage.dart -i coverage/coverage.json --fail-under=90
(Secondary approach):-
Following the possible cause of previous approach.
I tried to shift the coveragePercentage calculation to
bin/format_coverage.dart
to get it executed.This is what I did:
double coveragePercentage = 0.0;
, inbin/format_coverage.dart
.hitmap
calculationcalculateCoverage(hitmap);
:bin/format_coverage.dart
instead of adding it inlib/src/formatter.dart
.Testing:
dart test --coverage=coverage
and gathered coverage data. data was successfully gathered with all tests passed.dart run coverage:format_coverage -i coverage/test -o coverage/coverage.json --report-on=lib
--fail-under
by running:dart bin/format_coverage.dart -i coverage/coverage.json --fail-under=90
Result:
double coveragePercentage = 0.0;
.Conclusion:
Possible cause:
Still trying to figure it out.
Any suggestions, feedback will be helpfull.