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
{{ message }}
Repository navigation
Add an "auto" mode for dart.testInvocationMode that tries to pick the best mode automatically #5716
We have a setting to run tests by line (instead of by name), but it's opt-in.
We could solve some issues by automatically defaulting to using lines if we think that running by-name will fail. For example #5707 where the group() call is not inside main() is problematic because the caller might have wrapped us in a group() and we won't include that in the computed full name.
Similarly, we have some workarounds for dynamic test names (test('foo $bar'...) to replace variables with .*, but running by line might be a cleaner way to do this.
When checking my config, it seems I may have been using by-line for a long time not realising (and forgetting that it wasn't default) so it might be pretty solid.
Some things we should do:
Change the default to undefined/"auto" instead of "name" so we can still force running all tests by-name in case there are any problems when we automatically use lines
Verify behaviour with tests that come from results (like pkg:test_reflective_loader) because we don't currently track their locations and might do the wrong thing (although, if we minimize where we default to by-line for, that might minimize this)
Probably candidates to run by-line by default:
Any variables/dynamic names (we may want to use the presence of quotes in the Outline name for this?)
changed the title [-]Default to running tests by line when they might otherwise fail[/-][+]Add an "auto" mode for dart.testInvocationMode that tries to pick the best mode automatically[/+]on Sep 22, 2026
The issue with unsaved files was not due to the edits, but rather that saving the file can cause formatting, which can change the lines.
So, if a file is unsaved, we will always use "name" if you selected "auto", and for now we are not changing the default, it's just a better option than "line".
Activity
DanTup commentedon Nov 20, 2025
This doesn't play too nice with unsaved files, so we need to do some more work here.
[-]Default to running tests by line when they might otherwise fail[/-][+]Add an "auto" mode for dart.testInvocationMode that tries to pick the best mode automatically[/+]DanTup commentedon Sep 22, 2026
The issue with unsaved files was not due to the edits, but rather that saving the file can cause formatting, which can change the lines.
So, if a file is unsaved, we will always use "name" if you selected "auto", and for now we are not changing the default, it's just a better option than "line".
Add an "auto" option for dart.testInvocatationMode that selects intel…