-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
dart test/package:test can now run tests by line/column numbers with query strings on the test files:
dart test -r json "test/line_test.dart?line=4" "test/line_test.dart?line=5"
This is something I'd like to adopt in VS Code instead of using --name because that's error-prone when names are dynamic (which comes up more than you'd expect):
test('foo bar', () {});
[1, 2].forEach((i) {
test('foo $i', () { // At analysis time, we don't have a reliable name for running this test
});
});
This is not currently supported by Flutter. When trying to run one, it says there are no tests:
danny@Dannys-MacBook-Pro dartcode_flutter_4021 % flutter test "test/widget_test.dart?line=31"
No tests ran.
No tests were found.
And when trying to run two, it prints an error and never completes:
danny@Dannys-MacBook-Pro dartcode_flutter_4021 % flutter test "test/widget_test.dart?line=31" "test/widget_test.dart?line=32"
00:01 +0: loading /Users/danny/Desktop/dart_samples/dartcode_flutter_4021/test/widget_test.dart Shell: [ERROR:flutter/runtime/dart_isolate.cc(144)] Could not prepare isolate.
Shell: [ERROR:flutter/runtime/runtime_controller.cc(390)] Could not create root isolate.
Shell: [ERROR:flutter/shell/common/shell.cc(606)] Could not launch engine with configuration.
00:44 +0: loading /Users/danny/Desktop/dart_samples/dartcode_flutter_4021/test/widget_test.dart
Importantly, for VS code this needs to also work when using --machine and --start-paused. There are some existing complications with running multiple suites with these flags but supporting just a single suite (and multiple tests within it) would be sufficient for VS Code (although whether it's possible to support that without also "fixing" funning multiple suites, I'm not sure).