-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[flutter_tools] Consistently set the working directory for Flutter Test #74622
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
[flutter_tools] Consistently set the working directory for Flutter Test #74622
Conversation
00deb12 to
a161c02
Compare
a161c02 to
147b8ff
Compare
147b8ff to
8a10bb1
Compare
8a10bb1 to
c9f5cf3
Compare
|
CI seems to have stalled, but the tool tests pass locally, so marking it as ready for review first. |
|
I think IDEs may be already compensating for this in some way. I would double check with @devoncarew and @DanTup that this is safe to change |
|
(Otherwise I'm all for the idea) |
|
Not doing anything to handle this in VS Code (the inconsistency occurs there unless there's a workaround in the user code), so fixing this here would be beneficial for VS Code users :-) |
|
For IntelliJ, when launching |
|
It should be pretty easy to validate that |
jonahwilliams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
(but please verify in AS/Intellij too) |
|
Yup, verified locally with the IntelliJ and VSCode plugins, we still can run individual tests via the UI. |
Fixes #20907. This makes
Directory.currentin tests always return the root of the flutter project, irregardless of whether the test command isflutter test(run all tests in$project/test), orflutter test test/foo_test.dart(run a specific test file).Context: I was trying to initialize an application package as a follow up to #74236 (to run integration tests with
flutter test). I got it to work for a single test, but running multiple tests did not work, because theFlutterProject.current()used in creating an application package works differently depending on the current working directory.Not sure if this is alright though, it seems a bit breaking for users depending on the incorrect behavior. This is somewhat mitigated because users probably use
flutter testto run all tests on CI, and the cases where I had to fix in this PR are probably less common (invokingflutter testin a subprocess from the test script). I also patched this and ran a global presubmit internally and there are no failures.