Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support different launch.json default configs for test runner when Running/Debugging #3854

Closed
DanTup opened this issue Mar 2, 2022 · 3 comments
Labels
in testing Relates to test execution of Dart/Flutter tests for end users is enhancement
Milestone

Comments

@DanTup
Copy link
Member

DanTup commented Mar 2, 2022

There may have to be some caveats around:

  • names must be Run/Debug
  • paths might be ignored (or required to null, test or integration_test)

Reverting bac9c3d makes this work in some cases, but we don't want to revert everything, we just need to selectively allow the test runner to read non-"default" (templateFor) templates.

@DanTup DanTup added is enhancement in testing Relates to test execution of Dart/Flutter tests for end users labels Mar 2, 2022
@DanTup DanTup added this to the v3.38.0 milestone Mar 2, 2022
@DanTup DanTup changed the title Support launch.json codeLens (or a better-named equivalent) as defaults for test runner Support different launch.json default configs for test runner when Running/Debugging Mar 3, 2022
@DanTup DanTup closed this as completed in efa647e Mar 3, 2022
@DanTup
Copy link
Member Author

DanTup commented Mar 3, 2022

@evanweible-wf @alanknight-wk I changed my mind on this a little - rather than making CodeLens apply directly to the TestRunner, I made templateFor a little more customisable. If you include an explicit noDebug flag in the launch config, it will be selected by a matching Run/Debug invocation from the test runner.

		{
			"name": "Run Tests",
			"type": "dart",
			"request": "launch",
			"noDebug": true,
			"env": { "FOO": "used for Running tests" },
			"templateFor": ""
		},
		{
			"name": "Debug Tests",
			"type": "dart",
			"request": "launch",
			"noDebug": false,
			"env": { "FOO": "used for Debugging tests" },
			"templateFor": ""
		},
		{
			"name": "Run Tests",
			"type": "dart",
			"request": "launch",
			"env": { "FOO": "used by default if either of the above are removed" },
			"templateFor": ""
		}

This change was included in a new pre-release version. If you want to test it out without waiting for the next stable version, you can switch to the pre-release versions of the extensions in VS Code using the buttons shown in the screenshot below.

Dart/Flutter pre-release versions

Please let me know if you hit any issues. Thanks!

@evanweible-wf
Copy link

Thanks Dan, that worked great for running tests! I'm having trouble with debugging, the tests being run seem to timeout while waiting for them to load:

Retrying load of test[/unit/http/utils_test.dart]() in 1s (2 remaining)
Retrying load of test[/unit/http/utils_test.dart]() in 1s (1 remaining)
Retrying load of test[/unit/http/utils_test.dart]() in 1s (0 remaining)

but that might be related to the fact that the parent process is dart run dart_dev test which itself starts a subprocess to run build_runner test, I'm not sure.

@DanTup
Copy link
Member Author

DanTup commented Mar 3, 2022

@evanweible-wf are you able to share a small repro I can test with? (it's worth filing a new issue since it's not strictly related to this one)

A log file captured with Dart: Capture Debugging Logs may also be useful. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in testing Relates to test execution of Dart/Flutter tests for end users is enhancement
Projects
None yet
Development

No branches or pull requests

2 participants