Skip to content

avoid_skipped_tests

v1.1.0WarningConfigurableTesting Rules

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.

allow_reason: true reports only the bare skip: true form, and lets a skip carrying a reason string through:

analysis_options.yaml
many_lints:
rules:
avoid_skipped_tests:
allow_reason: true
void 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.

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.

Option Type Default Description
allow_reason bool false Permit skip: 'reason string', and report only the bare skip: true form

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:

many_lints.yaml
rules:
avoid_skipped_tests: false

To 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