File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -129,14 +129,21 @@ class TestContext {
129129 /// External VM service.
130130 VmService get vmService => debugConnection.vmService;
131131
132- TestContext (this .project, this .sdkConfigurationProvider);
132+ final String _savedCurrentDirectory;
133+
134+ TestContext (this .project, this .sdkConfigurationProvider)
135+ : _savedCurrentDirectory = p.current;
133136
134137 Future <void > setUp ({
135138 TestSettings testSettings = const TestSettings (),
136139 TestAppMetadata appMetadata = const TestAppMetadata .externalApp (),
137140 TestDebugSettings debugSettings = const TestDebugSettings .noDevTools (),
138141 }) async {
139142 try {
143+ // The frontend server modifies the current path. Make sure that we
144+ // restore it every time the context is set up so that if a previous
145+ // test failed to tear down, we don't affect future tests.
146+ DartUri .currentDirectory = _savedCurrentDirectory;
140147 // Build settings to return from load strategy.
141148 final buildSettings = TestBuildSettings (
142149 appEntrypoint: project.dartEntryFilePackageUri,
Original file line number Diff line number Diff line change @@ -15,9 +15,7 @@ const newDdcTypeSystemVersion = '3.3.0-242.0.dev';
1515/// The path to the webdev directory in the local machine, e.g.
1616/// '/workstation/webdev'.
1717String get webdevPath {
18- // Use `Directory.current` instead of `p.current` as the latter is allowed to
19- // change with `DartUri.currentDirectory` modifications.
20- final pathParts = p.split (Directory .current.path);
18+ final pathParts = p.split (p.current);
2119 assert (pathParts.contains (webdevDirName));
2220 return p.joinAll (
2321 pathParts.sublist (0 , pathParts.lastIndexOf (webdevDirName) + 1 ),
You can’t perform that action at this time.
0 commit comments