Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit c16dded

Browse files
orevialOlivier
and
Olivier
authored
fix: add fail assertion as a valid method to missing_test_assertion rule (#1069)
Co-authored-by: Olivier <[email protected]>
1 parent cad9335 commit c16dded

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

lib/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/visitor.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class _MethodAssertionVisitor extends RecursiveAstVisitor<void> {
7474
'expectAsyncUntil5',
7575
'expectAsyncUntil6',
7676
'expectLater',
77+
'fail',
7778
};
7879

7980
_MethodAssertionVisitor(Iterable<String> includeAssertions) {

test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/examples/correct_example.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,9 @@ void main() {
7474
expectAsyncUntil6((p0, p1, p2, p3, p4, p5) {}, () => true);
7575
});
7676

77+
test('with fail', () {
78+
fail('some failure reason');
79+
});
80+
7781
test(null, () => expect(1, 1));
7882
}

website/docs/rules/common/missing-test-assertion.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import RuleDetails from '@site/src/components/RuleDetails';
55
Warns that there is no assertion in the test.
66

77
Use `include-assertions` configuration, if you want to include specific assertions.
8-
Defaults to Dart default assertions including expect, expectLater and all expectAsync variants.
8+
Defaults to Dart default assertions including expect, expectLater, all expectAsync variants and fail.
99

1010
Use `include-methods` configuration, if you want the linter to check particular test methods for missing assertions.
1111
Defaults to `test` and `testWidgets` methods.

0 commit comments

Comments
 (0)