-
Notifications
You must be signed in to change notification settings - Fork 340
Description
Describe the bug
Once you're trying to run test, which description contains variable or type used in other test, multiple tests would be executed.
This could be annoying if you're using some kind of BLoC/Redux actions, which types may be located in multiple test descriptions.
Simular issue in /test repo: dart-lang/test#1760.
There we found out, that the plugin could interprete expressions like 'is $Object' incorrectly.
To Reproduce
Run 'is $Object' test.
import 'package:test/test.dart';
class MyObj {
final number = 10;
bool foo() => true;
}
void main() {
group('$MyObj', () {
late MyObj myObj;
setUp(() {
myObj = MyObj();
});
test('is $Object', () {
expect(myObj, isA<Object>());
});
test('foo returns true and is an $Object', () {
expect(myObj.foo(), isTrue);
expect(myObj, isA<Object>());
});
test('number equals 10', () {
expect(myObj.number, equals(10));
});
});
}Expected behavior
Running 'is $Object' test, via IDE would execute only selected test.
Screenshots

It seems like plugin runs test like this.

Where $Object is an empty env. Which means, that we try to run test with 'is ' description, which also suits for the second test.
Please complete the following information:
- Operating System and version: macOS 12.3.1 (21E258)
- VS Code version: 1.71.0
- Dart extension version: v3.48.2
- Dart/Flutter SDK version: 2.17.3