Skip to content

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

Closed

Description

@giggitygoat

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

Activity

  1. DanTup commented on Oct 23, 2023

    @DanTup
    Member

    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)

  2. added
    awaiting infoRequires more information from the customer to progress
    on Oct 23, 2023
  3. DanTup commented on Oct 23, 2023

    @DanTup
    Member

    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.

  4. added this to the v3.76.0 milestone on Oct 23, 2023
  5. added
    in flutterRelates to running Flutter apps
    and removed
    awaiting infoRequires more information from the customer to progress
    on Oct 23, 2023
  6. added a commit that references this issue on Oct 23, 2023
  7. giggitygoat commented on Oct 24, 2023

    @giggitygoat
    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.

  8. DanTup commented on Oct 24, 2023

    @DanTup
    Member

    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.

  9. giggitygoat commented on Oct 24, 2023

    @giggitygoat
    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!

  10. added
    in testingRelates to test execution of Dart/Flutter tests for end users
    on Oct 24, 2023
  11. DanTup commented on Oct 24, 2023

    @DanTup
    Member

    Fixed by 74fd1ff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in flutterRelates to running Flutter appsin testingRelates to test execution of Dart/Flutter tests for end usersis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions