very_good_cli icon indicating copy to clipboard operation
very_good_cli copied to clipboard

feat: Add commonly desired debug configurations for tests to launch.json

Open jolexxa opened this issue 3 years ago • 0 comments

Description

Being able to debug tests (besides using the code lens options that show up in the test file itself) can be very helpful when testing. Additionally, we can allow developers to visually debug their widget tests by seeing the results on the device or simulator while also setting breakpoints, a huge advantage over just running flutter from the terminal.

Another perk of adding more launch configurations is discoverability: developers can more easily understand how to customize the launch.json for their particular apps and discover flutter debugging options they might not have known about, which encourages best practices.

For more information about Dart's debug configurations, see https://dartcode.org/docs/launch-configuration/.

What follows are the launch.json configs for some common testing scenarios:

For visually debugging the current widget test in the simulator/device/browser:

    {
      "name": "Debug Current Widget Test Visually",
      "request": "launch",
      "type": "dart",
      "program": "${relativeFile}",
      "runTestsOnDevice": true,
      "args": [
        "--flavor",
        "development",
      ]
    },

For debugging the current test:

    {
      "name": "Debug Current Test",
      "request": "launch",
      "type": "dart",
      "program": "${relativeFile}",
    },

Additional Context

Simulator Screen Shot - iPhone 13 - 2021-10-26 at 12 29 27 *

jolexxa avatar Feb 13 '22 06:02 jolexxa