Add testMode config to debug tests via the DAP --test flag#97
Open
FrantisekGazo wants to merge 1 commit into
Open
Add testMode config to debug tests via the DAP --test flag#97FrantisekGazo wants to merge 1 commit into
FrantisekGazo wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an optional boolean
testModeto the debug configuration. Whentrue, the extension spawns the debug adapter with the--testflag ([fvm] flutter|dart debug_adapter --test), soprogramruns viaflutter test/dart testinstead offlutter run/dart run. Works for both"type": "flutter"and"type": "dart". Defaultfalse— existing configs are unaffected.{ "label": "Debug current test file", "adapter": "Dart", "type": "flutter", "request": "launch", "program": "$ZED_FILE", "cwd": "$ZED_DIRNAME", "testMode": true }Why
There was previously no way to debug a test the way it actually executes under
flutter test(headlessflutter_tester,AutomatedTestWidgetsFlutterBinding, goldens, …). The only workaround wasflutter test --start-pausedplus a manual attach with a freshly pastedvmServiceUrion every run. The Dart/Flutter SDKs ship this as a mode of the same adapter — see the Flutter DAP README (--[no-]test); the extension just never exposed it.Changes
src/dart.rs— readtestMode; append--testto the adapter arguments; skip thedeviceId → toolArgs -d <id>injection in test mode (flutter testruns headless — device selection is aflutter runconcept, and users who need-dfor integration tests can still pass it viatoolArgs).debug_adapter_schemas/Dart.json— declaretestMode(schema hasadditionalProperties: false); remove the dead"test"value from theflutterModeenum — the DAP treatsflutterModeas a build mode (debug/profile/release), so"test"never did anything and would now be mistaken for this switch.README.md— "Debugging tests" section with the config above.In test mode
toolArgskeep their existing meaning — the DAP forwards them toflutter test/dart test(e.g.--plain-name,--tags).Tested
flutter+testMode: trueon a widget test: headlessflutter testrun, breakpoints/stepping/variables work;toolArgs: ["--plain-name", …]narrows to a single test.flutter runlaunch and attach configs behave unchanged withtestModeunset.