diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 3ac02a9d6..6b8e1cde4 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -23,7 +23,10 @@ final context = TestContext( final dwdsDir = Directory.current.absolute.path; /// The directory for the general _test package. -final testDir = p.join(p.dirname(dwdsDir), 'fixtures', '_test'); +final testDir = p.normalize(p.absolute(p.relative( + p.join('..', 'fixtures', '_test'), + from: p.current, +))); /// The directory for the _testPackage package (contained within dwds), which /// imports _test. diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index f563ddc29..ed4940ecf 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -121,14 +121,14 @@ class TestContext { this.path = 'hello_world/index.html', this.pathToServe = 'example', }) { - final packageName = nullSafety == NullSafety.sound ? '_testSound' : '_test'; - final relativeDirectory = p.join('..', 'fixtures', packageName); + final defaultPackage = + nullSafety == NullSafety.sound ? '_testSound' : '_test'; + final defaultDirectory = p.join('..', 'fixtures', defaultPackage); + final defaultEntry = p.join('..', 'fixtures', defaultPackage, 'example', + 'append_body', 'main.dart'); - final relativeEntry = p.join( - '..', 'fixtures', packageName, 'example', 'append_body', 'main.dart'); - - workingDirectory = p.normalize(p - .absolute(directory ?? p.relative(relativeDirectory, from: p.current))); + workingDirectory = p.normalize( + p.absolute(p.relative(directory ?? defaultDirectory, from: p.current))); DartUri.currentDirectory = workingDirectory; @@ -138,7 +138,7 @@ class TestContext { p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); final entryFilePath = p.normalize( - p.absolute(entry ?? p.relative(relativeEntry, from: p.current))); + p.absolute(p.relative(entry ?? defaultEntry, from: p.current))); _logger.info('Serving: $pathToServe/$path'); _logger.info('Project: $_projectDirectory');