Skip to main content

tarpit 0.1.2 copy "tarpit: ^0.1.2" to clipboard
tarpit: ^0.1.2 copied to clipboard

Find widget-test code that can hang in FakeAsync, and fail a stalled testWidgets fast. An analyzer-based CLI (text, JSON, SARIF) plus a watchdog.

Changelog #

0.1.2 #

  • --test-function <name> (repeatable): also check bodies of custom testWidgets wrappers. The body is still the second positional argument and must be a function literal. Thanks @nahuel007ng (#5).

0.1.1 #

  • Watchdog: a test whose body returns while the rest of the test waits on a microtask nothing flushes now fails with a TarpitStall instead of hanging. Engine image work (toByteData, toImage, getNextFrame) awaited outside tester.runAsync as the body's last await did this (flutter/flutter#50783). The watchdog now runs until the test's tear-down, and the report says when the body had already returned (TarpitStall.bodyReturned).
  • Docs: engine image calls do not block the test isolate, and the watchdog catches them; the README, doc/rules.md and the engine-async text said otherwise.

0.1.0 #

First release.

  • tarpit command: checks testWidgets bodies with the Dart analyzer (resolved AST, not text matching) for code that stalls the FakeAsync zone. Code inside tester.runAsync is skipped; the same patterns inside nested closures, or in files whose imports do not resolve, are reported as info.
  • Rules: fake-delay, real-io, isolate-hop, engine-async (errors), blocking-sleep, endless-settle (warnings), asset-string (info), and bad-suppression for malformed suppression comments.
  • Suppressions with a required reason: // tarpit:allow <rule-id> <reason> for one line, // tarpit:allow-file <rule-id> <reason> for a file.
  • Text, JSON (tarpit-json, formatVersion: 1) and SARIF 2.1.0 output; --fail-on, --output, --rules; exit codes 0 / 1 / 2.
  • Watchdog (package:tarpit/tarpit.dart): tarpitWidgets, watchTester and Tarpit.stallAfter fail a widget test that makes no progress (no pump, no frame) for 30 seconds with a TarpitStall describing the state it was stuck in, then let the next test run. package:tarpit/flutter_test.dart is flutter_test with that testWidgets, for a one-line opt-in.
0
likes
160
points
861
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Find widget-test code that can hang in FakeAsync, and fail a stalled testWidgets fast. An analyzer-based CLI (text, JSON, SARIF) plus a watchdog.

Repository (GitHub)
View/report issues
Contributing

Topics

#testing #flutter #lint #ci #static-analysis

License

MIT (license)

Dependencies

analyzer, args, flutter, flutter_test, meta, path

More

Packages that depend on tarpit