You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expect(AppliedCalculatorBase().calculate(), 10);
and re-run the previous command, coverage is reported as being 100% (as expected).
Expected behaviour
Coverage should be correctly reported for mixins even when they are only applied in test files.
Additional note
Implementing TestAppliedCalculatorBase as class TestAppliedCalculatorBase extends CalculatorBase {} reports correct coverage for CalculatorBase even when only used in tests.
dart --version: Dart SDK version: 2.19.4 (stable) (Tue Mar 7 09:58:46 2023 +0000) on "macos_x64"
The text was updated successfully, but these errors were encountered:
stevemessick
added
the
area-test
Cross-cutting test issues (use area- labels for specific failures; not used for package:test).
label
Mar 20, 2023
Further tested this with: Dart SDK version: 3.0.0-290.3.beta (beta) (Tue Mar 21 16:51:50 2023 +0000) on "macos_x64" and it is working as expected i.e. the line coverage is correctly reported.
On the other hand, I tested this with: Dart SDK version: 2.19.5 (stable) (Mon Mar 20 17:09:37 2023 +0000) on "macos_x64" and the line coverage is not correctly reported.
Additionally, it seems that this issue is the same as one reported at #49887.
cc @liamappelbe as you seemed to have resolved the previous one.
That's odd. Seems like it could be the same bug as #49887, but the fix for that landed in 2.18.3. It's good that this new bug seems to be fixed in 3.0.0, but I'd like to understand why it's happening in 2.19.5.
General description:
When a mixin is provided by a library but only applied in tests, coverage isn't reported for these mixins.
Meaning, a mixin only has its coverage reported if it is applied in the package and then the class applying it used in tests.
Consider the following example files:
and
If we run:
coverage is reported as:
lines......: 0.0% (0 of 2 lines)
If we, however, uncomment:
expect(AppliedCalculatorMixin().calculate(), 10);
and,expect(AppliedCalculatorBase().calculate(), 10);
and re-run the previous command, coverage is reported as being 100% (as expected).
Expected behaviour
Coverage should be correctly reported for mixins even when they are only applied in test files.
Additional note
Implementing
TestAppliedCalculatorBase
asclass TestAppliedCalculatorBase extends CalculatorBase {}
reports correct coverage forCalculatorBase
even when only used in tests.dart --version
:Dart SDK version: 2.19.4 (stable) (Tue Mar 7 09:58:46 2023 +0000) on "macos_x64"
The text was updated successfully, but these errors were encountered: