Run tests using line/col to support groups/test with dynamic names
See original GitHub issueAdded by @DanTup:
Some test cases to ensure are handled:
Describe the bug I have some functions to give a specific format to the descriptions of the groups and tests, like indentation, in this way it is easier to read them in the console, but when I execute a specific test, giving run in that group or test it tells me:
No tests match regular expression "^groupDescriptionFormatted\('group 1'\)".
To Reproduce this is a minimal example:
import 'package:test/test.dart';
String groupDescriptionFormatted(String description) {
return description;
}
String subGroupDescriptionFormatted(String description) {
return '\n $description';
}
void main() {
group(
groupDescriptionFormatted('group 1'),
() {
group(subGroupDescriptionFormatted('sub group 1'), () {
test('test', () {
expect(true, isTrue);
});
});
},
);
group(
groupDescriptionFormatted('group 2'),
() {
group(subGroupDescriptionFormatted('sub group 1'), () {
test('test', () {
expect(true, isTrue);
});
});
},
);
}
If you press run or debug on a specific group or test, you can see the error, an also in the testing tab you can see that the names are the function instead of the real test name.
If you press run or debug on main, or use the command run all tests, it runs normal but also in the testing tab keep the names are the function instead of the real test name, and now also the real tests names.
Thank you.
Please complete the following information: Operating System and version: Windows 10 VS Code version: 1.68.0 Dart extension version: 3.42.0 Dart/Flutter SDK version: flutter 3.0.1
Issue Analytics
- State:
- Created a year ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
I tested this using latest Flutter master (I missed you were using Flutter, so it should’ve been
flutter test
) and it seems to work as you’d like:So at least for a future version of Flutter, once this is implemented I believe what you’re after works. (I tested it with
rendersText
in another file too, same result - I just inlined it here for the screenshot).Started looking at this, but think we may be blocked on:
How to proceed will depend a little on the response to the
test
issue. If this is WAI and can’t be changed, we may have to change how things work here a little more.