Skip to content

Default directory for running tests is not the root directory #1156

@liboz

Description

@liboz

Currently, when running flutter test, one has to run it in the root directory of a Flutter project, but the working directory when running the test is the directory of the test file. When running tests through Dart-Code via the GUI interface in the code/Running tests inside VS Code in general, the working directory is instead the root directory.

Repro Steps:

  1. Create a new Flutter project called testing in VS Code via the command palette.
  2. In the default widget_test.dart file created, import dart:io and add the following print statement inside the default test print(Directory.current);
  3. Run the test inside VS Code either through the circled Run button
    code_2018-08-16_21-36-35 or from the panel on the left.
  4. The output in the Debug Console is testing.
  5. Running flutter test through the flutter console manually in the root directory results in the output being testing/test

Is there a reason for this difference in behavior?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions