avoid_skipped_tests
Warns when a test, group or whole library is switched off with skip: or @Skip(...). A skipped test still counts as a test: the runner reports it and exits zero, so the suite keeps growing while the evidence it provides shrinks.
Every gate downstream stays green. CI passes. A mirror-test presence check like require_mirror_test is satisfied, because the file still exists. A coverage gate sees the file counted but never executed.
A skip with no reason, and a skip with one — the reason makes it readable, not acceptable:
void main() { test('parses a malformed manifest', () {}, skip: true);
test('handles a timeout', () {}, skip: 'flaky on CI');}A whole group at once:
void main() { group('upload', () { test('retries once', () {}); test('gives up after three', () {}); }, skip: true);}A whole file, as a library annotation. It must be the first directive in the file:
@Skip('needs a real device')library;
void main() { test('reads the camera', () {});}Fix the test:
void main() { test('parses a malformed manifest', () { expect(() => parse(malformed), throwsA(isA<ManifestFailure>())); });}Or delete it. A deleted test is honest about what is covered; a skipped one is not.
Permitting a documented skip
Section titled “Permitting a documented skip”allow_reason: true reports only the bare skip: true form, and lets a skip
carrying a reason string through:
many_lints: rules: avoid_skipped_tests: allow_reason: truerules: avoid_skipped_tests: allow_reason: truevoid main() { // Still reported — nothing says why. test('parses a malformed manifest', () {}, skip: true);
// Allowed at `allow_reason: true`. test('handles a timeout', () {}, skip: 'flaky on CI — see #412');}The default is false, because a documented skip still does not run.
Never reported
Section titled “Never reported”skip: false is a no-op, and occasionally appears as a deliberate placeholder:
void main() { test('runs like any other', () {}, skip: false);}A grep cannot replace this rule: skip: inside a string literal, or a skip
parameter on a helper of your own, are indistinguishable from the real thing in
text. The rule reads the AST, so they are not reported.
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
allow_reason |
bool | false |
Permit skip: 'reason string', and report only the bare skip: true form |
Turning this rule off
Section titled “Turning this rule off”This rule is in the recommended preset, so it is on with
preset: recommended, preset: opinionated or preset: pedantic. Add it to
preset: core with avoid_skipped_tests: true.
To turn it off:
rules: avoid_skipped_tests: falseTo keep the rule on but skip certain paths — a quarantine directory, if your
project wants one — use per-rule exclude.
See also: package:test — skipping tests | eslint-plugin-jest: no-disabled-tests
Related rules
Section titled “Related rules”avoid_focused_tests— Detect tests focused with solo:, which silences their siblings.avoid_misused_test_matchers— Detect test matchers used with incompatible value types.format_test_name— Hold test descriptions to a house pattern.prefer_correct_test_file_name— Name test files so the runner actually runs them.