Repository navigation
Closed
Labels
Description
I apologize in advance for this issue being incomplete.
I'm experiencing the issue with one of my package and I cannot identify the cause,
I tried to reproduce the behavior with the code sample below, but it behave as intended
failed code sample
set up
sudo apt install lcov
flutter pub global activate coverage
flutter pub global activate stagehand
mkdir coverage_issue && cd coverage_issue
stagehand package-simplecode
- create
src/foo.dart
class Foo {
const Foo();
int call(String string) => string.length;
}- create
src/extension.dart
import 'foo.dart';
extension FooX on String {
int fooify() {
final foo = Foo();
return foo(this);
}
}
test
create test/foo_test.dart
import 'package:coverage_issue/coverage_issue.dart';
import 'package:test/test.dart';
void main() {
test('foo test', () {
const string = 'hello';
final foo = Foo();
expect(foo(string), string.length);
});
test('fooify test', () {
const string = 'hello';
expect(string.fooify(), string.length);
});
}commands
flutter test --coverage
format_coverage --lcov --check-ignore --in=coverage --out=coverage.lcov --packages=.packages --report-on=lib
genhtml -o coverage/html coverage/lcov.inforesults
Reading data file coverage/lcov.info
Resolved relative source file path "lib/src/foo.dart" with CWD to "/home/yakforward/projects/coverage_issue/lib/src/foo.dart".
Found 2 entries.
Found common filename prefix "/home/yakforward/projects/coverage_issue/lib"
Writing .css and .png files.
Generating output.
Processing file src/extension.dart
Processing file src/foo.dart
Writing directory view page.
Overall coverage rate:
lines......: 100.0% (5 of 5 lines)
functions..: no data foundeverything seems to work as intended
running the same commands on my package I get the result below
Reading data file coverage/lcov.info
Resolved relative source file path "lib/src/classes/error/handler.dart" with CWD to "/home/yakforward/projects/yak_packages/packages/yak_runner/lib/src/classes/error/handler.dart".
Found 38 entries.
Found common filename prefix "/home/yakforward/projects/yak_packages/packages/yak_runner/lib/src"
Writing .css and .png files.
Generating output.
[...] /// tedious stuff
Writing directory view page.
Overall coverage rate:
lines......: 96.3% (208 of 216 lines)
functions..: no data foundlooking it up
cd coverage/html
chromium index.htmlthe (allegedly) not tested lines refer to 3 extensions (for short) parse, encode and decode
which are indeed tested (parse, encode and decode)
I'm aware that as it is the issue is hardly workable,
can you please suggest a way to reproduce the problem?
possibly related to #475
Activity
iapicca commentedon May 11, 2021
update
while somehow the issue disappeared "duplicating" the test for the (dart) package above
I'm experiencing the same problem with another package (from quite some time)
even if in a larger package the code is very much self contained and I feel that might
be consider a useful code sample
here is the ui-output of the coverage screenshot from the same commands of the partial code sample above
anyhow
this is the code
code (at the time of writing)
and this is the test
test (at the time of writing)
those are both uninteresting and my set up works just fine for the other widgets.
I wish I could be more helpful,
can you please suggest a way to reproduce the problem?
natebosch commentedon May 12, 2021
can you try renaming the test so that it ends in
_test.dart?iapicca commentedon May 12, 2021
... facepalm
my bad