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
patrol_cli allows configuring a custom test file suffix via patrol.test_file_suffix in pubspec.yaml (default: _test.dart). However, the log-parsing layer in patrol_log has no access to that setting and relies on name heuristics that assume the default suffix:
Display (TestEntry) — since fix(patrol, patrol_log): report correct test description when test fails #3167, a finished test entry strips the leading file-group prefix (to render description (dir/file.dart)) only when the first token of the name ends with _test. With a custom suffix (e.g. _spec.dart, producing group names like example_spec or flows.example_spec), the prefix is not recognized, so the line is printed with the prefix inline (✅ flows.example_spec grants permission) and without the file-path decoration. Cosmetic only — nothing is lost.
Start/finish matching (PatrolLogReader._normalizeTestName) — pre-existing: the reader strips the prefix from finish entries only when the first token contains a .. For a top-level test file with a custom suffix (group name example_spec, no dot), the finish entry is not normalized and may fail to match its start entry, affecting execution-time reporting.
Note the heuristics cannot be made smarter from the name alone — flows.example_spec (a file prefix) is indistinguishable from MyClass.myMethod (the first word of a description). A compile-time define also doesn't work here, because pretty()/_normalizeTestName run in the CLI process, which is compiled at activation time without project dart-defines.
Proposal
Thread the configured suffix from PubspecReader (patrol_cli) into PatrolLogReader at runtime (it is constructed by the test backends, which have access to the pubspec config), and use it — sanitized the same way TestBundler._createTestName sanitizes file names (drop .dart, replace non-identifier chars with _) — for both prefix detection in TestEntry display and _normalizeTestName matching, defaulting to _test when not provided.
Context
patrol_cliallows configuring a custom test file suffix viapatrol.test_file_suffixinpubspec.yaml(default:_test.dart). However, the log-parsing layer inpatrol_loghas no access to that setting and relies on name heuristics that assume the default suffix:TestEntry) — since fix(patrol, patrol_log): report correct test description when test fails #3167, a finished test entry strips the leading file-group prefix (to renderdescription (dir/file.dart)) only when the first token of the name ends with_test. With a custom suffix (e.g._spec.dart, producing group names likeexample_specorflows.example_spec), the prefix is not recognized, so the line is printed with the prefix inline (✅ flows.example_spec grants permission) and without the file-path decoration. Cosmetic only — nothing is lost.PatrolLogReader._normalizeTestName) — pre-existing: the reader strips the prefix from finish entries only when the first token contains a.. For a top-level test file with a custom suffix (group nameexample_spec, no dot), the finish entry is not normalized and may fail to match its start entry, affecting execution-time reporting.Note the heuristics cannot be made smarter from the name alone —
flows.example_spec(a file prefix) is indistinguishable fromMyClass.myMethod(the first word of a description). A compile-time define also doesn't work here, becausepretty()/_normalizeTestNamerun in the CLI process, which is compiled at activation time without project dart-defines.Proposal
Thread the configured suffix from
PubspecReader(patrol_cli) intoPatrolLogReaderat runtime (it is constructed by the test backends, which have access to the pubspec config), and use it — sanitized the same wayTestBundler._createTestNamesanitizes file names (drop.dart, replace non-identifier chars with_) — for both prefix detection inTestEntrydisplay and_normalizeTestNamematching, defaulting to_testwhen not provided.Affected code
packages/patrol_log/lib/src/entries/test_entry.dart(_hasFilePathPrefix,nameWithPath)packages/patrol_log/lib/src/patrol_log_reader.dart(_normalizeTestName)packages/patrol_cli/lib/src/android/android_test_backend.dartand other backends constructingPatrolLogReaderSeverity
Low — only affects projects that override
test_file_suffix, and for display it is purely cosmetic. Related: #3048, #3167.