Skip to content

Using a subdirectory named 'tool' in test makes vscode freeze #4809

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

Closed
giggitygoat opened this issue Oct 23, 2023 · 6 comments
Closed

Using a subdirectory named 'tool' in test makes vscode freeze #4809

giggitygoat opened this issue Oct 23, 2023 · 6 comments
Labels
in flutter Relates to running Flutter apps in testing Relates to test execution of Dart/Flutter tests for end users is bug
Milestone

Comments

@giggitygoat
Copy link

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:

  1. Create new flutter package project
  2. Create folder named tool under test
  3. 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);
  });
}
  1. 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

@DanTup
Copy link
Member

DanTup commented Oct 23, 2023

I don't see VS Code freeze here, but I see this error in the debug console:

image

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 DanTup added the awaiting info Requires more information from the customer to progress label Oct 23, 2023
@DanTup
Copy link
Member

DanTup commented 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 tool folder (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.

DanTup added a commit that referenced this issue Oct 23, 2023
@DanTup DanTup added this to the v3.76.0 milestone Oct 23, 2023
@DanTup DanTup added in flutter Relates to running Flutter apps and removed awaiting info Requires more information from the customer to progress labels Oct 23, 2023
DanTup added a commit that referenced this issue Oct 23, 2023
@giggitygoat
Copy link
Author

I don't see VS Code freeze here, but I see this error in the debug console:

image

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)

It should be noted my pubspec.yaml looks like this:

dev_dependencies:
  flutter_test:
    sdk: flutter
  test: any

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
Copy link
Member

DanTup commented Oct 24, 2023

It should be noted my pubspec.yaml looks like this:

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 running dart test test/tool/foo_test.dart in 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 flutter to run the tests). Generally I don't think you should have/need test in your pubspec for Flutter tests.

@giggitygoat
Copy link
Author

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 running dart test test/tool/foo_test.dart in that case spews a huge number of errors).

I see, thanks for clarifying!

@DanTup DanTup added the in testing Relates to test execution of Dart/Flutter tests for end users label Oct 24, 2023
@DanTup
Copy link
Member

DanTup commented Oct 24, 2023

Fixed by 74fd1ff

@DanTup DanTup closed this as completed Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in flutter Relates to running Flutter apps in testing Relates to test execution of Dart/Flutter tests for end users is bug
Projects
None yet
Development

No branches or pull requests

2 participants