From 1b040016b20d16e2723b9278c534ab1b324c16b3 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 14:01:55 -0800 Subject: [PATCH 1/3] Another attempt at resolving failing tests --- dwds/test/fixtures/context.dart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index f563ddc29..cb064ed04 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.canonicalize( + p.relative(directory ?? defaultDirectory, from: p.current)); DartUri.currentDirectory = workingDirectory; @@ -137,8 +137,8 @@ class TestContext { _packageConfigFile = p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); - final entryFilePath = p.normalize( - p.absolute(entry ?? p.relative(relativeEntry, from: p.current))); + final entryFilePath = + p.canonicalize(p.relative(entry ?? defaultEntry, from: p.current)); _logger.info('Serving: $pathToServe/$path'); _logger.info('Project: $_projectDirectory'); From 1b9a6267cb398ca464d02bef590fa43ad83e20d5 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 15:22:46 -0800 Subject: [PATCH 2/3] Try to fix dart_uri_file_uri_test --- dwds/test/dart_uri_file_uri_test.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 3ac02a9d6..df64d843e 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.canonicalize(p.relative( + p.join('..', 'fixtures', '_test'), + from: p.current, +)); /// The directory for the _testPackage package (contained within dwds), which /// imports _test. From f96fb16a6f24487cc3dbfd35671f304728c66f5d Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 16:18:03 -0800 Subject: [PATCH 3/3] canonicalize -> normalize + absolute --- dwds/test/dart_uri_file_uri_test.dart | 4 ++-- dwds/test/fixtures/context.dart | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index df64d843e..6b8e1cde4 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -23,10 +23,10 @@ final context = TestContext( final dwdsDir = Directory.current.absolute.path; /// The directory for the general _test package. -final testDir = p.canonicalize(p.relative( +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 cb064ed04..ed4940ecf 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -127,8 +127,8 @@ class TestContext { final defaultEntry = p.join('..', 'fixtures', defaultPackage, 'example', 'append_body', 'main.dart'); - workingDirectory = p.canonicalize( - p.relative(directory ?? defaultDirectory, from: p.current)); + workingDirectory = p.normalize( + p.absolute(p.relative(directory ?? defaultDirectory, from: p.current))); DartUri.currentDirectory = workingDirectory; @@ -137,8 +137,8 @@ class TestContext { _packageConfigFile = p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); - final entryFilePath = - p.canonicalize(p.relative(entry ?? defaultEntry, from: p.current)); + final entryFilePath = p.normalize( + p.absolute(p.relative(entry ?? defaultEntry, from: p.current))); _logger.info('Serving: $pathToServe/$path'); _logger.info('Project: $_projectDirectory');