Using a subdirectory named 'tool' in test makes vscode freeze #4809
Copy link
Copy link
Closed
Labels
in flutterRelates to running Flutter appsRelates to running Flutter appsin testingRelates to test execution of Dart/Flutter tests for end usersRelates to test execution of Dart/Flutter tests for end usersis bug
Milestone
Description
Describe the bug
Currently if you make a simple dummy test in a folder named tool it makes vscode freeze and unable to complete.
To Reproduce
Steps to reproduce the behavior:
- Create new flutter package project
- Create folder named tool under test
- Create new file named my_test.dart and insert:
import 'package:flutter_test/flutter_test.dart';
void main() {
test('should expect null', () {
expect(null, isNull);
});
}- Click the green arrow to run the test
Expected behavior
To execute the file as if it was in the root of the test folder.
Please complete the following information:
Dart Code extension: 3.74.0
Flutter extension: 3.74.0 (activated)
App: Visual Studio Code
App Host: desktop
Version: linux 1.82.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in flutterRelates to running Flutter appsRelates to running Flutter appsin testingRelates to test execution of Dart/Flutter tests for end usersRelates to test execution of Dart/Flutter tests for end usersis bug
Activity
DanTup commentedon Oct 23, 2023
I don't see VS Code freeze here, but I see this error in the debug console:
Can you confirm exactly the behaviour you're seeing (what specifically you mean by freeze)?
(I'll look into what's causing this error in the meantime)
DanTup commentedon Oct 23, 2023
The reason for the error I'm seeing is that when we see something inside a "tool" folder we assume it's Dart (not Flutter), because it's common to put utility scripts inside a Flutter project inside a
toolfolder (which should run with the Dart CLI).It shouldn't be mis-categorising these inside a nested test/tool folder though, I'll work on fixing that.
Use top level folder name instead of finding bin/tool/etc. anywhere i…
Add tests for selecting debugger kinds
giggitygoat commentedon Oct 24, 2023
It should be noted my pubspec.yaml looks like this:
Which removed the error you are seeing. Furthermore, the freeze I am referring to is that when the test is executing I need to click the stop button some times before it reacts.
DanTup commentedon Oct 24, 2023
Ah, having
test:in your pubspec is why you're not seeing the same error. If I add that I see the same behaviour as you (and runningdart test test/tool/foo_test.dartin that case spews a huge number of errors).The fix I'm working on for the error I posted should solve both issues (by using
flutterto run the tests). Generally I don't think you should have/needtestin your pubspec for Flutter tests.giggitygoat commentedon Oct 24, 2023
I see, thanks for clarifying!
DanTup commentedon Oct 24, 2023
Fixed by 74fd1ff