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 01/26] 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 2ab2211f634531e4fce43ac7423e2110981150da Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 14:14:19 -0800 Subject: [PATCH 02/26] Merge in changes from other PR --- .github/workflows/dart.yml | 362 ++++++++++-------- dwds/mono_pkg.yaml | 4 +- dwds/test/inspector_test.dart | 19 +- dwds/test/instance_test.dart | 9 +- dwds/test/variable_scope_test.dart | 3 +- .../_test/example/scopes}/scopes.html | 0 .../_test/example/scopes}/scopes_main.dart | 0 .../_testSound/example/scopes/scopes.html | 7 + .../example/scopes/scopes_main.dart | 165 ++++++++ tool/ci.sh | 18 +- 10 files changed, 416 insertions(+), 171 deletions(-) rename {example/web => fixtures/_test/example/scopes}/scopes.html (100%) rename {example/web => fixtures/_test/example/scopes}/scopes_main.dart (100%) create mode 100644 fixtures/_testSound/example/scopes/scopes.html create mode 100644 fixtures/_testSound/example/scopes/scopes_main.dart diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index f5dd9565e..d74d4f2b5 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -1,4 +1,4 @@ -# Created with package:mono_repo v6.3.0 +# Created with package:mono_repo v6.4.2 name: Dart CI on: push: @@ -22,20 +22,22 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable" restore-keys: | os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - name: mono_repo self validate - run: dart pub global activate mono_repo 6.3.0 + run: dart pub global activate mono_repo 6.4.2 - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: @@ -43,7 +45,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:format-analyze_0-test_0" @@ -52,34 +54,36 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: dwds_pub_upgrade name: dwds; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds - run: dart pub upgrade - name: "dwds; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: "dart format --output=none --set-exit-if-changed ." - name: "dwds; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart analyze --fatal-infos . - name: dwds; dart test test/build/ensure_version_test.dart + run: dart test test/build/ensure_version_test.dart if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart test test/build/ensure_version_test.dart job_003: name: "analyzer_and_format; linux; Dart dev; PKGS: example, fixtures/_webdevSmoke, frontend_server_client, frontend_server_common; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:example-fixtures/_webdevSmoke-frontend_server_client-frontend_server_common;commands:format-analyze_0" @@ -88,105 +92,109 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: example_pub_upgrade name: example; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: example - run: dart pub upgrade - name: "example; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.example_pub_upgrade.conclusion == 'success'" working-directory: example - run: "dart format --output=none --set-exit-if-changed ." - name: "example; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . if: "always() && steps.example_pub_upgrade.conclusion == 'success'" working-directory: example - run: dart analyze --fatal-infos . - id: fixtures__webdevSmoke_pub_upgrade name: fixtures/_webdevSmoke; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: fixtures/_webdevSmoke - run: dart pub upgrade - name: "fixtures/_webdevSmoke; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.fixtures__webdevSmoke_pub_upgrade.conclusion == 'success'" working-directory: fixtures/_webdevSmoke - run: "dart format --output=none --set-exit-if-changed ." - name: "fixtures/_webdevSmoke; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . if: "always() && steps.fixtures__webdevSmoke_pub_upgrade.conclusion == 'success'" working-directory: fixtures/_webdevSmoke - run: dart analyze --fatal-infos . - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client - run: dart pub upgrade - name: "frontend_server_client; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client - run: "dart format --output=none --set-exit-if-changed ." - name: "frontend_server_client; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client - run: dart analyze --fatal-infos . - id: frontend_server_common_pub_upgrade name: frontend_server_common; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_common - run: dart pub upgrade - name: "frontend_server_common; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.frontend_server_common_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_common - run: "dart format --output=none --set-exit-if-changed ." - name: "frontend_server_common; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . if: "always() && steps.frontend_server_common_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_common - run: dart analyze --fatal-infos . job_004: name: "analyzer_and_format; linux; Dart dev; PKG: webdev; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`, `dart test test/build/ensure_build_test.dart`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:format-analyze_0-test_4" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:format-analyze_0-test_7" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: webdev_pub_upgrade name: webdev; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev - run: dart pub upgrade - name: "webdev; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: "dart format --output=none --set-exit-if-changed ." - name: "webdev; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart analyze --fatal-infos . - name: webdev; dart test test/build/ensure_build_test.dart + run: dart test test/build/ensure_build_test.dart if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart test test/build/ensure_build_test.dart job_005: name: "analyzer_and_format; linux; Dart stable; PKGS: dwds, webdev; `dart analyze .`, `dart test test/build/min_sdk_test.dart --run-skipped`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds-webdev;commands:analyze_1-test_1" @@ -195,69 +203,81 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: dwds_pub_upgrade name: dwds; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds - run: dart pub upgrade - name: dwds; dart analyze . + run: dart analyze . if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart analyze . - name: "dwds; dart test test/build/min_sdk_test.dart --run-skipped" + run: dart test test/build/min_sdk_test.dart --run-skipped if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart test test/build/min_sdk_test.dart --run-skipped - id: webdev_pub_upgrade name: webdev; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev - run: dart pub upgrade - name: webdev; dart analyze . + run: dart analyze . if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart analyze . - name: "webdev; dart test test/build/min_sdk_test.dart --run-skipped" + run: dart test test/build/min_sdk_test.dart --run-skipped if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart test test/build/min_sdk_test.dart --run-skipped job_006: - name: "unit_test; linux; Dart dev; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test`" + name: "unit_test; linux; Dart dev; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test --total-shards 3 --shard-index 0`, `dart test --total-shards 3 --shard-index 1`, `dart test --total-shards 3 --shard-index 2`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:command-test_2" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:command-test_2-test_3-test_4" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: dwds_pub_upgrade name: dwds; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds - run: dart pub upgrade - name: "dwds; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - - name: dwds; dart test + - name: "dwds; dart test --total-shards 3 --shard-index 0" + run: dart test --total-shards 3 --shard-index 0 + if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" + working-directory: dwds + - name: "dwds; dart test --total-shards 3 --shard-index 1" + run: dart test --total-shards 3 --shard-index 1 + if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" + working-directory: dwds + - name: "dwds; dart test --total-shards 3 --shard-index 2" + run: dart test --total-shards 3 --shard-index 2 if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart test needs: - job_001 - job_002 @@ -269,29 +289,31 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:frontend_server_client;commands:test_3" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:frontend_server_client;commands:test_6" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:frontend_server_client os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client - run: dart pub upgrade - name: "frontend_server_client; dart test -j 1" + run: dart test -j 1 if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client - run: dart test -j 1 needs: - job_001 - job_002 @@ -303,33 +325,35 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:command-test_3" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:command-test_6" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: webdev_pub_upgrade name: webdev; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev - run: dart pub upgrade - name: "webdev; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: "webdev; dart test -j 1" + run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart test -j 1 needs: - job_001 - job_002 @@ -337,37 +361,47 @@ jobs: - job_004 - job_005 job_009: - name: "unit_test; linux; Dart stable; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test`" + name: "unit_test; linux; Dart stable; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test --total-shards 3 --shard-index 0`, `dart test --total-shards 3 --shard-index 1`, `dart test --total-shards 3 --shard-index 2`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds;commands:command-test_2" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds;commands:command-test_2-test_3-test_4" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: dwds_pub_upgrade name: dwds; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds - run: dart pub upgrade - name: "dwds; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - - name: dwds; dart test + - name: "dwds; dart test --total-shards 3 --shard-index 0" + run: dart test --total-shards 3 --shard-index 0 + if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" + working-directory: dwds + - name: "dwds; dart test --total-shards 3 --shard-index 1" + run: dart test --total-shards 3 --shard-index 1 + if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" + working-directory: dwds + - name: "dwds; dart test --total-shards 3 --shard-index 2" + run: dart test --total-shards 3 --shard-index 2 if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart test needs: - job_001 - job_002 @@ -379,29 +413,31 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:frontend_server_client;commands:test_3" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:frontend_server_client;commands:test_6" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:frontend_server_client os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client - run: dart pub upgrade - name: "frontend_server_client; dart test -j 1" + run: dart test -j 1 if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client - run: dart test -j 1 needs: - job_001 - job_002 @@ -413,33 +449,35 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:webdev;commands:command-test_3" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:webdev;commands:command-test_6" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:webdev os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: webdev_pub_upgrade name: webdev; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev - run: dart pub upgrade - name: "webdev; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: "webdev; dart test -j 1" + run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart test -j 1 needs: - job_001 - job_002 @@ -450,20 +488,22 @@ jobs: name: "unit_test; windows; Dart dev; PKG: dwds; `dart test`" runs-on: windows-latest steps: - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: dwds_pub_upgrade name: dwds; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds - run: dart pub upgrade - name: dwds; dart test + run: dart test if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart test needs: - job_001 - job_002 @@ -474,20 +514,22 @@ jobs: name: "unit_test; windows; Dart dev; PKG: frontend_server_client; `dart test -j 1`" runs-on: windows-latest steps: - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client - run: dart pub upgrade - name: "frontend_server_client; dart test -j 1" + run: dart test -j 1 if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client - run: dart test -j 1 needs: - job_001 - job_002 @@ -498,20 +540,22 @@ jobs: name: "unit_test; windows; Dart dev; PKG: webdev; `dart test -j 1`" runs-on: windows-latest steps: - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: webdev_pub_upgrade name: webdev; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev - run: dart pub upgrade - name: "webdev; dart test -j 1" + run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart test -j 1 needs: - job_001 - job_002 @@ -522,20 +566,22 @@ jobs: name: "unit_test; windows; Dart stable; PKG: dwds; `dart test`" runs-on: windows-latest steps: - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: dwds_pub_upgrade name: dwds; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds - run: dart pub upgrade - name: dwds; dart test + run: dart test if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart test needs: - job_001 - job_002 @@ -546,20 +592,22 @@ jobs: name: "unit_test; windows; Dart stable; PKG: frontend_server_client; `dart test -j 1`" runs-on: windows-latest steps: - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client - run: dart pub upgrade - name: "frontend_server_client; dart test -j 1" + run: dart test -j 1 if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client - run: dart test -j 1 needs: - job_001 - job_002 @@ -570,20 +618,22 @@ jobs: name: "unit_test; windows; Dart stable; PKG: webdev; `dart test -j 1`" runs-on: windows-latest steps: - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: webdev_pub_upgrade name: webdev; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev - run: dart pub upgrade - name: "webdev; dart test -j 1" + run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart test -j 1 needs: - job_001 - job_002 @@ -593,36 +643,38 @@ jobs: job_018: name: "beta_cron; linux; Dart beta; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test -j 1`" runs-on: ubuntu-latest + if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds;commands:command-test_3" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds;commands:command-test_6" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds os:ubuntu-latest;pub-cache-hosted;sdk:beta os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: dwds_pub_upgrade name: dwds; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds - run: dart pub upgrade - name: "dwds; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: "dwds; dart test -j 1" + run: dart test -j 1 if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart test -j 1 - if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -644,36 +696,38 @@ jobs: job_019: name: "beta_cron; linux; Dart beta; PKG: webdev; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test -j 1`" runs-on: ubuntu-latest + if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev;commands:command-test_3" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev;commands:command-test_6" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev os:ubuntu-latest;pub-cache-hosted;sdk:beta os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: webdev_pub_upgrade name: webdev; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev - run: dart pub upgrade - name: "webdev; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: "webdev; dart test -j 1" + run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart test -j 1 - if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -695,9 +749,10 @@ jobs: job_020: name: "beta_cron; linux; Dart beta; PKG: dwds; `dart analyze .`" runs-on: ubuntu-latest + if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds;commands:analyze_1" @@ -706,21 +761,22 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:beta os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: dwds_pub_upgrade name: dwds; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds - run: dart pub upgrade - name: dwds; dart analyze . + run: dart analyze . if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart analyze . - if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -742,9 +798,10 @@ jobs: job_021: name: "beta_cron; linux; Dart beta; PKG: webdev; `dart analyze .`" runs-on: ubuntu-latest + if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev;commands:analyze_1" @@ -753,21 +810,22 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:beta os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: webdev_pub_upgrade name: webdev; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev - run: dart pub upgrade - name: webdev; dart analyze . + run: dart analyze . if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart analyze . - if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -789,22 +847,24 @@ jobs: job_022: name: "beta_cron; windows; Dart beta; PKG: dwds; `dart test -j 1`" runs-on: windows-latest + if: "github.event_name == 'schedule'" steps: - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: dwds_pub_upgrade name: dwds; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds - run: dart pub upgrade - name: "dwds; dart test -j 1" + run: dart test -j 1 if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - run: dart test -j 1 - if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -826,22 +886,24 @@ jobs: job_023: name: "beta_cron; windows; Dart beta; PKG: webdev; `dart test -j 1`" runs-on: windows-latest + if: "github.event_name == 'schedule'" steps: - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - name: Setup Dart SDK + uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 + name: Checkout repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: webdev_pub_upgrade name: webdev; dart pub upgrade + run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev - run: dart pub upgrade - name: "webdev; dart test -j 1" + run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev - run: dart test -j 1 - if: "github.event_name == 'schedule'" needs: - job_001 - job_002 diff --git a/dwds/mono_pkg.yaml b/dwds/mono_pkg.yaml index 5e2ccaf7f..59fad9bf3 100644 --- a/dwds/mono_pkg.yaml +++ b/dwds/mono_pkg.yaml @@ -13,7 +13,9 @@ stages: - unit_test: - group: - command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - - test: + - test: --total-shards 3 --shard-index 0 + - test: --total-shards 3 --shard-index 1 + - test: --total-shards 3 --shard-index 2 sdk: - dev - stable diff --git a/dwds/test/inspector_test.dart b/dwds/test/inspector_test.dart index 3999296d1..f71d1e226 100644 --- a/dwds/test/inspector_test.dart +++ b/dwds/test/inspector_test.dart @@ -15,8 +15,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; -final context = TestContext( - directory: '../example', path: 'scopes.html', pathToServe: 'web'); +final context = TestContext(path: 'scopes/scopes.html'); WipConnection get tabConnection => context.tabConnection; @@ -35,11 +34,11 @@ void main() { await context.tearDown(); }); - final url = 'org-dartlang-app:///web/scopes_main.dart'; + final url = 'org-dartlang-app:///example/scopes/scopes_main.dart'; /// A convenient way to get a library variable without boilerplate. String libraryVariableExpression(String variable) => - '${globalLoadStrategy.loadModuleSnippet}("dart_sdk").dart.getModuleLibraries("web/scopes_main")["$url"]["$variable"];'; + '${globalLoadStrategy.loadModuleSnippet}("dart_sdk").dart.getModuleLibraries("example/scopes/scopes_main")["$url"]["$variable"];'; Future libraryPublicFinal() => inspector.jsEvaluate(libraryVariableExpression('libraryPublicFinal')); @@ -225,27 +224,27 @@ void main() { } final jsMultiLineExceptionWithStackTrace = ''' -Error: Assertion failed: org-dartlang-app:///web/scopes_main.dart:4:11 +Error: Assertion failed: org-dartlang-app:///example/scopes/scopes_main.dart:4:11 false "THIS IS THE ASSERT MESSAGE" - at Object.assertFailed (org-dartlang-app:///web/scopes_main.dart.js:5297:15) + at Object.assertFailed (org-dartlang-app:///example/scopes/scopes_main.dart.js:5297:15) '''; final formattedMultiLineExceptionWithStackTrace = ''' -Error: Assertion failed: org-dartlang-app:///web/scopes_main.dart:4:11 +Error: Assertion failed: org-dartlang-app:///example/scopes/scopes_main.dart:4:11 false "THIS IS THE ASSERT MESSAGE" -org-dartlang-app:///web/scopes_main.dart.js 5297:15 assertFailed +org-dartlang-app:///example/scopes/scopes_main.dart.js 5297:15 assertFailed '''; final jsMultiLineExceptionNoStackTrace = ''' -Error: Assertion failed: org-dartlang-app:///web/scopes_main.dart:4:11 +Error: Assertion failed: org-dartlang-app:///example/scopes/scopes_main.dart:4:11 false "THIS IS THE ASSERT MESSAGE" '''; final formattedMultiLineExceptionNoStackTrace = ''' -Error: Assertion failed: org-dartlang-app:///web/scopes_main.dart:4:11 +Error: Assertion failed: org-dartlang-app:///example/scopes/scopes_main.dart:4:11 false "THIS IS THE ASSERT MESSAGE" '''; diff --git a/dwds/test/instance_test.dart b/dwds/test/instance_test.dart index a5c64c74c..d642b9a89 100644 --- a/dwds/test/instance_test.dart +++ b/dwds/test/instance_test.dart @@ -14,8 +14,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; -final context = TestContext( - directory: '../example', path: 'scopes.html', pathToServe: 'web'); +final context = TestContext(path: 'scopes/scopes.html'); WipConnection get tabConnection => context.tabConnection; @@ -34,10 +33,10 @@ void main() { await context.tearDown(); }); - final url = 'org-dartlang-app:///web/scopes_main.dart'; + final url = 'org-dartlang-app:///example/scopes/scopes_main.dart'; String libraryVariableExpression(String variable) => - '${globalLoadStrategy.loadModuleSnippet}("dart_sdk").dart.getModuleLibraries("web/scopes_main")' + '${globalLoadStrategy.loadModuleSnippet}("dart_sdk").dart.getModuleLibraries("example/scopes/scopes_main")' '["$url"]["$variable"];'; /// A reference to the the variable `libraryPublicFinal`, an instance of @@ -81,7 +80,7 @@ void main() { expect(classRef.name, 'MyTestClass'); expect( classRef.id, - 'classes|org-dartlang-app:///web/scopes_main.dart' + 'classes|org-dartlang-app:///example/scopes/scopes_main.dart' '|MyTestClass'); }); diff --git a/dwds/test/variable_scope_test.dart b/dwds/test/variable_scope_test.dart index 9a592ec6d..ec5f8239f 100644 --- a/dwds/test/variable_scope_test.dart +++ b/dwds/test/variable_scope_test.dart @@ -12,8 +12,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; -final context = TestContext( - directory: '../example', path: 'scopes.html', pathToServe: 'web'); +final context = TestContext(path: 'scopes/scopes.html'); ChromeProxyService get service => fetchChromeProxyService(context.debugConnection); WipConnection get tabConnection => context.tabConnection; diff --git a/example/web/scopes.html b/fixtures/_test/example/scopes/scopes.html similarity index 100% rename from example/web/scopes.html rename to fixtures/_test/example/scopes/scopes.html diff --git a/example/web/scopes_main.dart b/fixtures/_test/example/scopes/scopes_main.dart similarity index 100% rename from example/web/scopes_main.dart rename to fixtures/_test/example/scopes/scopes_main.dart diff --git a/fixtures/_testSound/example/scopes/scopes.html b/fixtures/_testSound/example/scopes/scopes.html new file mode 100644 index 000000000..6c3307394 --- /dev/null +++ b/fixtures/_testSound/example/scopes/scopes.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/fixtures/_testSound/example/scopes/scopes_main.dart b/fixtures/_testSound/example/scopes/scopes_main.dart new file mode 100644 index 000000000..ea7338a16 --- /dev/null +++ b/fixtures/_testSound/example/scopes/scopes_main.dart @@ -0,0 +1,165 @@ +// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// An example with more complicated scope +import 'dart:async'; +import 'dart:collection'; + +final libraryPublicFinal = MyTestClass(); + +final _libraryPrivateFinal = 1; +Object? libraryNull; +var libraryPublic = ['library', 'public', 'variable']; +var notAList = NotReallyAList(); + +var _libraryPrivate = ['library', 'private', 'variable']; + +var identityMap = {}; + +var map = {}; + +void staticFunction(int formal) { + print(formal); // Breakpoint: staticFunction +} + +void main() async { + print('Initial print from scopes app'); + var local = 'local in main'; + var intLocalInMain = 42; + var testClass = MyTestClass(); + Object? localThatsNull; + identityMap['a'] = 1; + identityMap['b'] = 2; + map['a'] = [1, 2, 3]; + map['b'] = 'something'; + notAList.add(7); + + String nestedFunction(T parameter, Object aClass) { + var another = int.tryParse('$parameter'); + return '$local: parameter, $another'; // Breakpoint: nestedFunction + } + + dynamic nestedWithClosure(String banana) { + return () => '$local + $banana'; + } + + Timer.periodic(const Duration(seconds: 1), (Timer t) { + var ticks = t.tick; + // ignore: unused_local_variable, prefer_typing_uninitialized_variables + var closureLocal; + libraryPublicFinal.printCount(); + staticFunction(1); + print('ticking... $ticks (the answer is $intLocalInMain)'); + print(nestedFunction('$ticks ${testClass.message}', Timer)); + print(localThatsNull); + print(libraryNull); + var localList = libraryPublic; + print(localList); + localList.add('abc'); + var f = testClass.methodWithVariables(); + print(f('parameter')); + var num = '1234'.someExtensionMethod(); + print('$num'); + }); + + print(_libraryPrivateFinal); + print(_libraryPrivate); + print(nestedFunction(_libraryPrivate.first, Object)); + print(nestedWithClosure(_libraryPrivate.first)()); +} + +String libraryFunction(String arg) { + print('calling a library function with $arg'); + var concat = 'some constant plus $arg plus whatever'; + print(concat); + return concat; +} + +abstract class MyAbstractClass { + String abstractField = 'abstract-field-value'; +} + +class MyTestClass extends MyAbstractClass { + final String message; + + String? notFinal; + + MyTestClass({this.message = 'world'}) { + myselfField = this; + tornOff = toString; + } + + String hello() => message; + + String Function(String) methodWithVariables() { + var local = '$message + something'; + print(local); + return (String parameter) { + // Be sure to use a field from this, so it isn't entirely optimized away. + var closureLocalInsideMethod = '$message/$local/$parameter'; + print(closureLocalInsideMethod); + return closureLocalInsideMethod; // Breakpoint: nestedClosure + }; + } + + //ignore: avoid_returning_this + MyTestClass get myselfGetter => this; + + late final MyTestClass myselfField; + + var count = 0; + + // An easy location to add a breakpoint. + void printCount() { + print('The count is ${++count}'); + libraryFunction('abc'); // Breakpoint: printMethod + } + + final _privateField = 'a private field'; + + // ignore: unused_element + String privateMethod(String s) => '$s : $_privateField'; + + @override + String toString() => 'A test class with message $message'; + + bool equals(Object other) { + if (other is MyTestClass) return message == other.hello(); + return false; + } + + Function closure = someFunction; + + late final String Function() tornOff; +} + +Function? someFunction() => null; + +// ignore: unused_element +int _libraryPrivateFunction(int a, int b) => a + b; + +class NotReallyAList extends ListBase { + final List _internal; + + NotReallyAList() : _internal = []; + + @override + Object? operator [](x) => _internal[x]; + + @override + operator []=(int x, Object? y) => _internal[x] = y; + + @override + int get length => _internal.length; + + @override + set length(x) => _internal.length = x; +} + +extension NumberParsing on String { + int someExtensionMethod() { + var ret = int.parse(this); + return ret; // Breakpoint: extension + } +} diff --git a/tool/ci.sh b/tool/ci.sh index bb144cd12..51e3bc6b6 100755 --- a/tool/ci.sh +++ b/tool/ci.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Created with package:mono_repo v6.3.0 +# Created with package:mono_repo v6.4.2 # Support built in commands on windows out of the box. # When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") @@ -92,14 +92,26 @@ for PKG in ${PKGS}; do dart test test/build/min_sdk_test.dart --run-skipped || EXIT_CODE=$? ;; test_2) + echo 'dart test --total-shards 3 --shard-index 0' + dart test --total-shards 3 --shard-index 0 || EXIT_CODE=$? + ;; + test_3) + echo 'dart test --total-shards 3 --shard-index 1' + dart test --total-shards 3 --shard-index 1 || EXIT_CODE=$? + ;; + test_4) + echo 'dart test --total-shards 3 --shard-index 2' + dart test --total-shards 3 --shard-index 2 || EXIT_CODE=$? + ;; + test_5) echo 'dart test' dart test || EXIT_CODE=$? ;; - test_3) + test_6) echo 'dart test -j 1' dart test -j 1 || EXIT_CODE=$? ;; - test_4) + test_7) echo 'dart test test/build/ensure_build_test.dart' dart test test/build/ensure_build_test.dart || EXIT_CODE=$? ;; From 3afe52e51f79e240cd68b282b30e6f523bdb113f Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 15:17:13 -0800 Subject: [PATCH 03/26] Refactor context.dart --- dwds/test/build_daemon_breakpoint_test.dart | 4 +- dwds/test/fixtures/context.dart | 69 +++++++++++++++------ 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/dwds/test/build_daemon_breakpoint_test.dart b/dwds/test/build_daemon_breakpoint_test.dart index 14a7df87e..43c97e621 100644 --- a/dwds/test/build_daemon_breakpoint_test.dart +++ b/dwds/test/build_daemon_breakpoint_test.dart @@ -15,8 +15,8 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; final context = TestContext( - directory: p.join('..', 'fixtures', '_testPackageSound'), - entry: p.join('..', 'fixtures', '_testPackageSound', 'web', 'main.dart'), + testFixturesPackageName: '_testPackageSound', + testFixturesEntryPath: p.join('web', 'main.dart'), path: 'index.html', pathToServe: 'web'); diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index cb064ed04..d5202ff7d 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -107,29 +107,49 @@ class TestContext { late String workingDirectory; /// The path to build and serve. - String pathToServe; + late String pathToServe; /// The path part of the application URL. - String path; + late String path; NullSafety nullSafety; - TestContext({ - String? directory, - String? entry, - this.nullSafety = NullSafety.sound, - this.path = 'hello_world/index.html', - this.pathToServe = 'example', + TestContext.withSoundNullSafety({ + String packageName = '_testSound', + String webAssetsPath = 'example/hello_world', + String dartEntryFileName = 'main.dart', + String htmlEntryFileName = 'index.html', + }) : this._( + nullSafety: NullSafety.sound, + packageName: packageName, + webAssetsPath: webAssetsPath, + dartEntryFileName: dartEntryFileName, + htmlEntryFileName: htmlEntryFileName, + ); + + TestContext.withWeakNullSafety({ + String packageName = '_test', + String webAssetsPath = 'example/hello_world', + String dartEntryFileName = 'main.dart', + String htmlEntryFileName = 'index.html', + }) : this._( + nullSafety: NullSafety.weak, + packageName: packageName, + webAssetsPath: webAssetsPath, + dartEntryFileName: dartEntryFileName, + htmlEntryFileName: htmlEntryFileName, + ); + + TestContext._({ + required String packageName, + required String webAssetsPath, + required String dartEntryFileName, + required String htmlEntryFileName, + required this.nullSafety, }) { - final defaultPackage = - nullSafety == NullSafety.sound ? '_testSound' : '_test'; - final defaultDirectory = p.join('..', 'fixtures', defaultPackage); - final defaultEntry = p.join('..', 'fixtures', defaultPackage, 'example', - 'append_body', 'main.dart'); - - workingDirectory = p.canonicalize( - p.relative(directory ?? defaultDirectory, from: p.current)); - + final isSoundPackage = packageName.toLowerCase().contains('sound'); + assert(nullSafety == NullSafety.sound ? isSoundPackage : !isSoundPackage); + workingDirectory = _canonicalizeFromFixtures([packageName]); DartUri.currentDirectory = workingDirectory; // package_config.json is located in /.dart_tool/package_config @@ -137,8 +157,13 @@ class TestContext { _packageConfigFile = p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); - final entryFilePath = - p.canonicalize(p.relative(entry ?? defaultEntry, from: p.current)); + pathToServe = _canonicalizeFromFixtures(p.split(webAssetsPath)); + final entryFilePath = _canonicalizeFromFixtures( + [packageName, ...p.split(webAssetsPath), dartEntryFileName], + ); + path = _canonicalizeFromFixtures( + [packageName, ...p.split(webAssetsPath), htmlEntryFileName], + ); _logger.info('Serving: $pathToServe/$path'); _logger.info('Project: $_projectDirectory'); @@ -149,6 +174,12 @@ class TestContext { _entryContents = _entryFile.readAsStringSync(); } + String _canonicalizeFromFixtures(List pathParts) { + return p.canonicalize(p.relative( + p.join('..', 'fixtures', p.joinAll(pathParts)), + from: p.current)); + } + Future setUp({ ReloadConfiguration reloadConfiguration = ReloadConfiguration.none, bool serveDevTools = false, From f2ef91b2c081f529d1c0f16f892014f29741a78d Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 15:42:50 -0800 Subject: [PATCH 04/26] wip --- dwds/test/events_test.dart | 2 +- dwds/test/fixtures/context.dart | 12 +++++++----- dwds/test/handlers/asset_handler_test.dart | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dwds/test/events_test.dart b/dwds/test/events_test.dart index 7b313195f..9c36e9687 100644 --- a/dwds/test/events_test.dart +++ b/dwds/test/events_test.dart @@ -22,7 +22,7 @@ ChromeProxyService get service => WipConnection get tabConnection => context.tabConnection; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); void main() { group('serve requests', () { diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index d5202ff7d..2217d45f5 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -157,7 +157,7 @@ class TestContext { _packageConfigFile = p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); - pathToServe = _canonicalizeFromFixtures(p.split(webAssetsPath)); + pathToServe = webAssetsPath; final entryFilePath = _canonicalizeFromFixtures( [packageName, ...p.split(webAssetsPath), dartEntryFileName], ); @@ -165,10 +165,10 @@ class TestContext { [packageName, ...p.split(webAssetsPath), htmlEntryFileName], ); - _logger.info('Serving: $pathToServe/$path'); - _logger.info('Project: $_projectDirectory'); - _logger.info('Packages: $_packageConfigFile'); - _logger.info('Entry: $entryFilePath'); + print('Serving: $pathToServe/$path'); + print('Project: $_projectDirectory'); + print('Packages: $_packageConfigFile'); + print('Entry: $entryFilePath'); _entryFile = File(entryFilePath); _entryContents = _entryFile.readAsStringSync(); @@ -261,6 +261,8 @@ class TestContext { _port = await findUnusedPort(); final soundNullSafety = nullSafety == NullSafety.sound; + print('working directory: $workingDirectory'); + print('path to serve: $pathToServe'); switch (compilationMode) { case CompilationMode.buildDaemon: { diff --git a/dwds/test/handlers/asset_handler_test.dart b/dwds/test/handlers/asset_handler_test.dart index ee48fbf30..408b3cee8 100644 --- a/dwds/test/handlers/asset_handler_test.dart +++ b/dwds/test/handlers/asset_handler_test.dart @@ -10,7 +10,7 @@ import '../fixtures/logging.dart'; void main() { group('Asset handler', () { - final context = TestContext(); + final context = TestContext.withSoundNullSafety(); setUpAll(() async { setCurrentLogWriter(); From 9aa7be4fcfc0ce927765c66e10fb405753f86319 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 16:05:50 -0800 Subject: [PATCH 05/26] refactored TestContext constructors --- dwds/test/fixtures/context.dart | 74 ++++++++++++++++----------------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 2217d45f5..0d72940e2 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -106,45 +106,46 @@ class TestContext { /// Top level directory in which we run the test server.. late String workingDirectory; - /// The path to build and serve. - late String pathToServe; + /// The directory to build and serve (eg, `example`). + late String directoryToServe; - /// The path part of the application URL. - late String path; + /// The path to the HTML file to serve, relative to the [directoryToServe] + /// (eg, `hello_world/index.html`). + late String filePathToServe; NullSafety nullSafety; TestContext.withSoundNullSafety({ String packageName = '_testSound', - String webAssetsPath = 'example/hello_world', - String dartEntryFileName = 'main.dart', - String htmlEntryFileName = 'index.html', + String webAssetsDirectoryName = 'example', + String dartEntryFilePath = 'hello_world/main.dart', + String htmlEntryFilePath = 'hello_world/index.html', }) : this._( nullSafety: NullSafety.sound, packageName: packageName, - webAssetsPath: webAssetsPath, - dartEntryFileName: dartEntryFileName, - htmlEntryFileName: htmlEntryFileName, + webAssetsDirectoryName: webAssetsDirectoryName, + dartEntryFilePath: dartEntryFilePath, + htmlEntryFilePath: htmlEntryFilePath, ); TestContext.withWeakNullSafety({ String packageName = '_test', - String webAssetsPath = 'example/hello_world', - String dartEntryFileName = 'main.dart', - String htmlEntryFileName = 'index.html', + String webAssetsDirectoryName = 'example', + String dartEntryFilePath = 'hello_world/main.dart', + String htmlEntryFilePath = 'hello_world/index.html', }) : this._( nullSafety: NullSafety.weak, packageName: packageName, - webAssetsPath: webAssetsPath, - dartEntryFileName: dartEntryFileName, - htmlEntryFileName: htmlEntryFileName, + webAssetsDirectoryName: webAssetsDirectoryName, + dartEntryFilePath: dartEntryFilePath, + htmlEntryFilePath: htmlEntryFilePath, ); TestContext._({ required String packageName, - required String webAssetsPath, - required String dartEntryFileName, - required String htmlEntryFileName, + required String webAssetsDirectoryName, + required String dartEntryFilePath, + required String htmlEntryFilePath, required this.nullSafety, }) { final isSoundPackage = packageName.toLowerCase().contains('sound'); @@ -157,18 +158,15 @@ class TestContext { _packageConfigFile = p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); - pathToServe = webAssetsPath; + directoryToServe = webAssetsDirectoryName; + filePathToServe = htmlEntryFilePath; final entryFilePath = _canonicalizeFromFixtures( - [packageName, ...p.split(webAssetsPath), dartEntryFileName], + [packageName, webAssetsDirectoryName, ...p.split(dartEntryFilePath)], ); - path = _canonicalizeFromFixtures( - [packageName, ...p.split(webAssetsPath), htmlEntryFileName], - ); - - print('Serving: $pathToServe/$path'); - print('Project: $_projectDirectory'); - print('Packages: $_packageConfigFile'); - print('Entry: $entryFilePath'); + _logger.info('Serving: $directoryToServe/$filePathToServe'); + _logger.info('Project: $_projectDirectory'); + _logger.info('Packages: $_packageConfigFile'); + _logger.info('Entry: $entryFilePath'); _entryFile = File(entryFilePath); _entryContents = _entryFile.readAsStringSync(); @@ -261,8 +259,6 @@ class TestContext { _port = await findUnusedPort(); final soundNullSafety = nullSafety == NullSafety.sound; - print('working directory: $workingDirectory'); - print('path to serve: $pathToServe'); switch (compilationMode) { case CompilationMode.buildDaemon: { @@ -284,7 +280,7 @@ class TestContext { record.stackTrace); }); daemonClient.registerBuildTarget( - DefaultBuildTarget((b) => b..target = pathToServe)); + DefaultBuildTarget((b) => b..target = directoryToServe)); daemonClient.startBuild(); await daemonClient.buildResults @@ -294,10 +290,10 @@ class TestContext { final assetServerPort = daemonPort(workingDirectory); _assetHandler = proxyHandler( - 'http://localhost:$assetServerPort/$pathToServe/', + 'http://localhost:$assetServerPort/$directoryToServe/', client: client); assetReader = - ProxyServerAssetReader(assetServerPort, root: pathToServe); + ProxyServerAssetReader(assetServerPort, root: directoryToServe); if (enableExpressionEvaluation) { ddcService = ExpressionCompilerService( @@ -320,7 +316,7 @@ class TestContext { break; case CompilationMode.frontendServer: { - _logger.warning('Index: $path'); + _logger.warning('Index: $filePathToServe'); final entry = p.toUri(_entryFile.path .substring(_projectDirectory.toFilePath().length + 1)); @@ -347,7 +343,7 @@ class TestContext { final assetServerPort = await findUnusedPort(); await webRunner.run(fileSystem, hostname, assetServerPort, - p.join(pathToServe, path)); + p.join(directoryToServe, filePathToServe)); if (enableExpressionEvaluation) { expressionCompiler = webRunner.expressionCompiler; @@ -408,7 +404,7 @@ class TestContext { assetHandler, assetReader, requireStrategy, - pathToServe, + directoryToServe, buildResults, () async => connection, serveDevTools, @@ -425,8 +421,8 @@ class TestContext { ); _appUrl = basePath.isEmpty - ? 'http://localhost:$port/$path' - : 'http://localhost:$port/$basePath/$path'; + ? 'http://localhost:$port/$filePathToServe' + : 'http://localhost:$port/$basePath/$filePathToServe'; if (launchChrome) { await _webDriver?.get(appUrl); From d8497c743878b89c1ff88347077c6ab6c1897a9c Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:32:52 -0800 Subject: [PATCH 06/26] Use new TestContext constructors everywhere --- dwds/test/build_daemon_breakpoint_test.dart | 12 ++++----- dwds/test/build_daemon_callstack_test.dart | 23 ++++++++--------- dwds/test/chrome_proxy_service_test.dart | 2 +- dwds/test/dart_uri_file_uri_test.dart | 11 ++++---- dwds/test/debug_extension_test.dart | 6 ++--- dwds/test/debug_service_test.dart | 2 +- dwds/test/debugger_test.dart | 2 +- dwds/test/devtools_test.dart | 4 +-- dwds/test/evaluate_circular_common.dart | 25 +++++++++---------- dwds/test/evaluate_common.dart | 24 +++++++++--------- dwds/test/fixtures/context.dart | 22 ++++++++++------ .../test/frontend_server_breakpoint_test.dart | 12 ++++----- dwds/test/frontend_server_callstack_test.dart | 23 ++++++++--------- dwds/test/inspector_test.dart | 5 +++- dwds/test/instance_test.dart | 5 +++- dwds/test/listviews_test.dart | 2 +- dwds/test/puppeteer/extension_test.dart | 2 +- dwds/test/puppeteer/lifeline_test.dart | 2 +- .../proxy_server_asset_reader_test.dart | 2 +- dwds/test/refresh_test.dart | 2 +- dwds/test/reload_test.dart | 5 ++-- dwds/test/restore_breakpoints_test.dart | 2 +- dwds/test/run_request_test.dart | 2 +- dwds/test/screenshot_test.dart | 2 +- dwds/test/variable_scope_test.dart | 5 +++- 25 files changed, 104 insertions(+), 100 deletions(-) diff --git a/dwds/test/build_daemon_breakpoint_test.dart b/dwds/test/build_daemon_breakpoint_test.dart index 43c97e621..520192001 100644 --- a/dwds/test/build_daemon_breakpoint_test.dart +++ b/dwds/test/build_daemon_breakpoint_test.dart @@ -7,18 +7,18 @@ import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; -import 'package:path/path.dart' as p; import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; -final context = TestContext( - testFixturesPackageName: '_testPackageSound', - testFixturesEntryPath: p.join('web', 'main.dart'), - path: 'index.html', - pathToServe: 'web'); +final context = TestContext.withSoundNullSafety( + packageName: '_testPackageSound', + webAssetsDirectoryName: 'web', + dartEntryFilePath: 'main.dart', + htmlEntryFilePath: 'index.html', +); ChromeProxyService get service => fetchChromeProxyService(context.debugConnection); diff --git a/dwds/test/build_daemon_callstack_test.dart b/dwds/test/build_daemon_callstack_test.dart index 2ccb9f1ae..7b30ef4c0 100644 --- a/dwds/test/build_daemon_callstack_test.dart +++ b/dwds/test/build_daemon_callstack_test.dart @@ -7,7 +7,6 @@ import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; -import 'package:path/path.dart' as p; import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; @@ -17,20 +16,18 @@ import 'fixtures/logging.dart'; import 'utils/version_compatibility.dart'; class TestSetup { - static final contextUnsound = TestContext( - directory: p.join('..', 'fixtures', '_testPackage'), - entry: p.join('..', 'fixtures', '_testPackage', 'web', 'main.dart'), - path: 'index.html', - pathToServe: 'web', - nullSafety: NullSafety.weak, + static final contextUnsound = TestContext.withWeakNullSafety( + packageName: '_testPackage', + dartEntryFilePath: 'main.dart', + htmlEntryFilePath: 'index.html', + webAssetsDirectoryName: 'web', ); - static final contextSound = TestContext( - directory: p.join('..', 'fixtures', '_testPackageSound'), - entry: p.join('..', 'fixtures', '_testPackageSound', 'web', 'main.dart'), - path: 'index.html', - pathToServe: 'web', - nullSafety: NullSafety.sound, + static final contextSound = TestContext.withSoundNullSafety( + packageName: '_testPackageSound', + dartEntryFilePath: 'main.dart', + htmlEntryFilePath: 'index.html', + webAssetsDirectoryName: 'web', ); TestContext context; diff --git a/dwds/test/chrome_proxy_service_test.dart b/dwds/test/chrome_proxy_service_test.dart index 6e238524a..1e39eb297 100644 --- a/dwds/test/chrome_proxy_service_test.dart +++ b/dwds/test/chrome_proxy_service_test.dart @@ -20,7 +20,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; import 'fixtures/logging.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); ChromeProxyService get service => fetchChromeProxyService(context.debugConnection); diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 3ac02a9d6..3b4d2d5d2 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -12,12 +12,11 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; import 'utils/version_compatibility.dart'; -final context = TestContext( - directory: p.join('..', 'fixtures', '_testPackage'), - entry: p.join('..', 'fixtures', '_testPackage', 'web', 'main.dart'), - path: 'index.html', - pathToServe: 'web', - nullSafety: NullSafety.weak, +final context = TestContext.withWeakNullSafety( + packageName: '_testPackage', + webAssetsDirectoryName: 'web', + dartEntryFilePath: 'main.dart', + htmlEntryFilePath: 'index.html', ); final dwdsDir = Directory.current.absolute.path; diff --git a/dwds/test/debug_extension_test.dart b/dwds/test/debug_extension_test.dart index 25ebdfb05..328e03d52 100644 --- a/dwds/test/debug_extension_test.dart +++ b/dwds/test/debug_extension_test.dart @@ -28,7 +28,7 @@ import 'fixtures/utilities.dart'; // Remove the key before pushing code to GitHub. // See go/extension-identification. -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); void main() async { Future waitForDartDevToolsWithRetry({ @@ -202,7 +202,7 @@ void main() async { } group('With encoding', () { - final context = TestContext(); + final context = TestContext.withSoundNullSafety(); setUp(() async { await context.setUp( enableDebugExtension: true, @@ -223,7 +223,7 @@ void main() async { }); group('With "any" hostname', () { - final context = TestContext(); + final context = TestContext.withSoundNullSafety(); final uriPattern = RegExp(r'dartExtensionUri = "([^"]+)";'); setUp(() async { diff --git a/dwds/test/debug_service_test.dart b/dwds/test/debug_service_test.dart index c0fd9ec75..638d12e67 100644 --- a/dwds/test/debug_service_test.dart +++ b/dwds/test/debug_service_test.dart @@ -11,7 +11,7 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); void main() { setUpAll(() async { diff --git a/dwds/test/debugger_test.dart b/dwds/test/debugger_test.dart index 06992d43f..8ae4e2e3a 100644 --- a/dwds/test/debugger_test.dart +++ b/dwds/test/debugger_test.dart @@ -21,7 +21,7 @@ import 'fixtures/context.dart'; import 'fixtures/debugger_data.dart'; import 'fixtures/fakes.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); late AppInspector inspector; late Debugger debugger; late FakeWebkitDebugger webkitDebugger; diff --git a/dwds/test/devtools_test.dart b/dwds/test/devtools_test.dart index 5f6197688..6e7030772 100644 --- a/dwds/test/devtools_test.dart +++ b/dwds/test/devtools_test.dart @@ -12,9 +12,7 @@ import 'package:webdriver/io.dart'; import 'fixtures/context.dart'; -final context = TestContext( - path: 'append_body/index.html', -); +final context = TestContext.withSoundNullSafety(); Future _waitForPageReady(TestContext context) async { var attempt = 100; diff --git a/dwds/test/evaluate_circular_common.dart b/dwds/test/evaluate_circular_common.dart index f633badc5..5c37a4bc5 100644 --- a/dwds/test/evaluate_circular_common.dart +++ b/dwds/test/evaluate_circular_common.dart @@ -7,7 +7,6 @@ import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; -import 'package:path/path.dart' as p; import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; @@ -16,21 +15,21 @@ import 'fixtures/context.dart'; import 'fixtures/logging.dart'; class TestSetup { - static TestContext createContext( - String index, String packageRoot, NullSafety nullSafety) => - TestContext( - directory: p.join('..', 'fixtures', packageRoot), - entry: p.join('..', 'fixtures', packageRoot, 'web', 'main.dart'), - path: index, - pathToServe: 'web', - nullSafety: nullSafety, - ); - static TestContext contextUnsound(String index) => - createContext(index, '_testCircular2', NullSafety.weak); + TestContext.withWeakNullSafety( + packageName: '_testCircular2', + webAssetsDirectoryName: 'web', + dartEntryFilePath: 'main.dart', + htmlEntryFilePath: index, + ); static TestContext contextSound(String index) => - createContext(index, '_testCircular2Sound', NullSafety.sound); + TestContext.withSoundNullSafety( + packageName: '_testCircular2Sound', + webAssetsDirectoryName: 'web', + dartEntryFilePath: 'main.dart', + htmlEntryFilePath: index, + ); TestContext context; diff --git a/dwds/test/evaluate_common.dart b/dwds/test/evaluate_common.dart index e0829d4ae..053f4ce15 100644 --- a/dwds/test/evaluate_common.dart +++ b/dwds/test/evaluate_common.dart @@ -7,7 +7,6 @@ import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; -import 'package:path/path.dart' as p; import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; @@ -16,20 +15,21 @@ import 'fixtures/context.dart'; import 'fixtures/logging.dart'; class TestSetup { - static TestContext createContext( - String index, String packageRoot, NullSafety nullSafety) => - TestContext( - directory: p.join('..', 'fixtures', packageRoot), - entry: p.join('..', 'fixtures', packageRoot, 'web', 'main.dart'), - path: index, - pathToServe: 'web', - nullSafety: nullSafety); - static TestContext contextUnsound(String index) => - createContext(index, '_testPackage', NullSafety.weak); + TestContext.withWeakNullSafety( + packageName: '_testPackage', + webAssetsDirectoryName: 'web', + dartEntryFilePath: 'main.dart', + htmlEntryFilePath: index, + ); static TestContext contextSound(String index) => - createContext(index, '_testPackageSound', NullSafety.sound); + TestContext.withSoundNullSafety( + packageName: '_testPackageSound', + webAssetsDirectoryName: 'web', + dartEntryFilePath: 'main.dart', + htmlEntryFilePath: index, + ); TestContext context; diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 0d72940e2..fef612859 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -150,7 +150,7 @@ class TestContext { }) { final isSoundPackage = packageName.toLowerCase().contains('sound'); assert(nullSafety == NullSafety.sound ? isSoundPackage : !isSoundPackage); - workingDirectory = _canonicalizeFromFixtures([packageName]); + workingDirectory = testFixturesAbsolutePath([packageName]); DartUri.currentDirectory = workingDirectory; // package_config.json is located in /.dart_tool/package_config @@ -160,7 +160,7 @@ class TestContext { directoryToServe = webAssetsDirectoryName; filePathToServe = htmlEntryFilePath; - final entryFilePath = _canonicalizeFromFixtures( + final entryFilePath = testFixturesAbsolutePath( [packageName, webAssetsDirectoryName, ...p.split(dartEntryFilePath)], ); _logger.info('Serving: $directoryToServe/$filePathToServe'); @@ -172,12 +172,6 @@ class TestContext { _entryContents = _entryFile.readAsStringSync(); } - String _canonicalizeFromFixtures(List pathParts) { - return p.canonicalize(p.relative( - p.join('..', 'fixtures', p.joinAll(pathParts)), - from: p.current)); - } - Future setUp({ ReloadConfiguration reloadConfiguration = ReloadConfiguration.none, bool serveDevTools = false, @@ -547,3 +541,15 @@ class TestContext { return lineNumber + 1; } } + +String testFixturesAbsolutePath(List relativePathParts) => p.normalize( + p.absolute( + p.relative( + p.join( + '..', + 'fixtures', + p.joinAll(relativePathParts), + ), + from: p.current), + ), + ); diff --git a/dwds/test/frontend_server_breakpoint_test.dart b/dwds/test/frontend_server_breakpoint_test.dart index 7324f19ae..7122e06c4 100644 --- a/dwds/test/frontend_server_breakpoint_test.dart +++ b/dwds/test/frontend_server_breakpoint_test.dart @@ -7,7 +7,6 @@ import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; -import 'package:path/path.dart' as p; import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; @@ -16,12 +15,11 @@ import 'fixtures/context.dart'; import 'fixtures/logging.dart'; import 'utils/version_compatibility.dart'; -final context = TestContext( - directory: p.join('..', 'fixtures', '_testPackage'), - entry: p.join('..', 'fixtures', '_testPackage', 'web', 'main.dart'), - path: 'index.html', - pathToServe: 'web', - nullSafety: NullSafety.weak, +final context = TestContext.withWeakNullSafety( + packageName: '_testPackage', + webAssetsDirectoryName: 'web', + htmlEntryFilePath: 'index.html', + dartEntryFilePath: 'main.dart', ); ChromeProxyService get service => diff --git a/dwds/test/frontend_server_callstack_test.dart b/dwds/test/frontend_server_callstack_test.dart index 70479df5e..7a75e74f3 100644 --- a/dwds/test/frontend_server_callstack_test.dart +++ b/dwds/test/frontend_server_callstack_test.dart @@ -7,7 +7,6 @@ import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; -import 'package:path/path.dart' as p; import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; @@ -17,20 +16,18 @@ import 'fixtures/logging.dart'; import 'utils/version_compatibility.dart'; class TestSetup { - static final contextUnsound = TestContext( - directory: p.join('..', 'fixtures', '_testPackage'), - entry: p.join('..', 'fixtures', '_testPackage', 'web', 'main.dart'), - path: 'index.html', - pathToServe: 'web', - nullSafety: NullSafety.weak, + static final contextUnsound = TestContext.withWeakNullSafety( + packageName: '_testPackage', + webAssetsDirectoryName: 'web', + htmlEntryFilePath: 'index.html', + dartEntryFilePath: 'main.dart', ); - static final contextSound = TestContext( - directory: p.join('..', 'fixtures', '_testPackageSound'), - entry: p.join('..', 'fixtures', '_testPackageSound', 'web', 'main.dart'), - path: 'index.html', - pathToServe: 'web', - nullSafety: NullSafety.sound, + static final contextSound = TestContext.withSoundNullSafety( + packageName: '_testPackageSound', + webAssetsDirectoryName: 'web', + htmlEntryFilePath: 'index.html', + dartEntryFilePath: 'main.dart', ); TestContext context; diff --git a/dwds/test/inspector_test.dart b/dwds/test/inspector_test.dart index f71d1e226..6b3e28290 100644 --- a/dwds/test/inspector_test.dart +++ b/dwds/test/inspector_test.dart @@ -15,7 +15,10 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; -final context = TestContext(path: 'scopes/scopes.html'); +final context = TestContext.withSoundNullSafety( + dartEntryFilePath: 'scopes/scopes_main.dart', + htmlEntryFilePath: 'scopes/scopes.html', +); WipConnection get tabConnection => context.tabConnection; diff --git a/dwds/test/instance_test.dart b/dwds/test/instance_test.dart index d642b9a89..6e0d93e3a 100644 --- a/dwds/test/instance_test.dart +++ b/dwds/test/instance_test.dart @@ -14,7 +14,10 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; -final context = TestContext(path: 'scopes/scopes.html'); +final context = TestContext.withSoundNullSafety( + dartEntryFilePath: 'scopes/scopes_main.dart', + htmlEntryFilePath: 'scopes/scopes.html', +); WipConnection get tabConnection => context.tabConnection; diff --git a/dwds/test/listviews_test.dart b/dwds/test/listviews_test.dart index dfcfd2771..1c4bca34d 100644 --- a/dwds/test/listviews_test.dart +++ b/dwds/test/listviews_test.dart @@ -6,7 +6,7 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); void main() { setUpAll(() async { diff --git a/dwds/test/puppeteer/extension_test.dart b/dwds/test/puppeteer/extension_test.dart index a95398603..b7163a918 100644 --- a/dwds/test/puppeteer/extension_test.dart +++ b/dwds/test/puppeteer/extension_test.dart @@ -21,7 +21,7 @@ import '../../debug_extension_mv3/web/data_types.dart'; import '../fixtures/context.dart'; import 'test_utils.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); void main() async { group('MV3 Debug Extension', () { diff --git a/dwds/test/puppeteer/lifeline_test.dart b/dwds/test/puppeteer/lifeline_test.dart index 600db189b..bd920dcc6 100644 --- a/dwds/test/puppeteer/lifeline_test.dart +++ b/dwds/test/puppeteer/lifeline_test.dart @@ -12,7 +12,7 @@ import 'package:test/test.dart'; import '../fixtures/context.dart'; import 'test_utils.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); void main() async { late Worker worker; diff --git a/dwds/test/readers/proxy_server_asset_reader_test.dart b/dwds/test/readers/proxy_server_asset_reader_test.dart index 53d6f3bec..30cc53585 100644 --- a/dwds/test/readers/proxy_server_asset_reader_test.dart +++ b/dwds/test/readers/proxy_server_asset_reader_test.dart @@ -10,7 +10,7 @@ import '../utils/version_compatibility.dart'; void main() { group('ProxyServerAssetReader', () { - final context = TestContext(nullSafety: NullSafety.weak); + final context = TestContext.withWeakNullSafety(); late ProxyServerAssetReader assetReader; setUpAll(() async { await context.setUp(); diff --git a/dwds/test/refresh_test.dart b/dwds/test/refresh_test.dart index 441bab9bc..ef28b1861 100644 --- a/dwds/test/refresh_test.dart +++ b/dwds/test/refresh_test.dart @@ -17,7 +17,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); ChromeProxyService get service => fetchChromeProxyService(context.debugConnection); WipConnection get tabConnection => context.tabConnection; diff --git a/dwds/test/reload_test.dart b/dwds/test/reload_test.dart index 76db65f28..5d0ea82c8 100644 --- a/dwds/test/reload_test.dart +++ b/dwds/test/reload_test.dart @@ -11,8 +11,9 @@ import 'package:vm_service/vm_service.dart'; import 'fixtures/context.dart'; import 'fixtures/logging.dart'; -final context = TestContext( - path: 'append_body/index.html', +final context = TestContext.withSoundNullSafety( + dartEntryFilePath: 'append_body/main.dart', + htmlEntryFilePath: 'append_body/index.html', ); void main() { diff --git a/dwds/test/restore_breakpoints_test.dart b/dwds/test/restore_breakpoints_test.dart index 2752a0c34..e637e6e36 100644 --- a/dwds/test/restore_breakpoints_test.dart +++ b/dwds/test/restore_breakpoints_test.dart @@ -14,7 +14,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; import 'fixtures/logging.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); ChromeProxyService get service => fetchChromeProxyService(context.debugConnection); WipConnection get tabConnection => context.tabConnection; diff --git a/dwds/test/run_request_test.dart b/dwds/test/run_request_test.dart index 9856c6665..5b461bdf7 100644 --- a/dwds/test/run_request_test.dart +++ b/dwds/test/run_request_test.dart @@ -12,7 +12,7 @@ import 'package:vm_service/vm_service.dart'; import 'fixtures/context.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); ChromeProxyService get service => fetchChromeProxyService(context.debugConnection); diff --git a/dwds/test/screenshot_test.dart b/dwds/test/screenshot_test.dart index af1441588..6a0999d08 100644 --- a/dwds/test/screenshot_test.dart +++ b/dwds/test/screenshot_test.dart @@ -6,7 +6,7 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; -final context = TestContext(); +final context = TestContext.withSoundNullSafety(); void main() { setUpAll(() async { diff --git a/dwds/test/variable_scope_test.dart b/dwds/test/variable_scope_test.dart index ec5f8239f..4e0df70bf 100644 --- a/dwds/test/variable_scope_test.dart +++ b/dwds/test/variable_scope_test.dart @@ -12,7 +12,10 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; -final context = TestContext(path: 'scopes/scopes.html'); +final context = TestContext.withSoundNullSafety( + dartEntryFilePath: 'scopes/scopes_main.dart', + htmlEntryFilePath: 'scopes/scopes.html', +); ChromeProxyService get service => fetchChromeProxyService(context.debugConnection); WipConnection get tabConnection => context.tabConnection; From 9fd513f06c509cad9edf29de9d0c5ddcf7245616 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:34:29 -0800 Subject: [PATCH 07/26] Revert mono_repo changes --- .github/workflows/dart.yml | 46 +++++++++++++------------------------- dwds/mono_pkg.yaml | 4 +--- tool/ci.sh | 16 ++----------- 3 files changed, 18 insertions(+), 48 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index d74d4f2b5..9ce5a72ae 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -159,7 +159,7 @@ jobs: uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:format-analyze_0-test_7" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:format-analyze_0-test_4" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -237,14 +237,14 @@ jobs: if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev job_006: - name: "unit_test; linux; Dart dev; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test --total-shards 3 --shard-index 0`, `dart test --total-shards 3 --shard-index 1`, `dart test --total-shards 3 --shard-index 2`" + name: "unit_test; linux; Dart dev; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:command-test_2-test_3-test_4" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:command-test_2" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -266,16 +266,8 @@ jobs: run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - - name: "dwds; dart test --total-shards 3 --shard-index 0" - run: dart test --total-shards 3 --shard-index 0 - if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" - working-directory: dwds - - name: "dwds; dart test --total-shards 3 --shard-index 1" - run: dart test --total-shards 3 --shard-index 1 - if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" - working-directory: dwds - - name: "dwds; dart test --total-shards 3 --shard-index 2" - run: dart test --total-shards 3 --shard-index 2 + - name: dwds; dart test + run: dart test if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds needs: @@ -292,7 +284,7 @@ jobs: uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:frontend_server_client;commands:test_6" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:frontend_server_client;commands:test_3" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:frontend_server_client os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -328,7 +320,7 @@ jobs: uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:command-test_6" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:command-test_3" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -361,14 +353,14 @@ jobs: - job_004 - job_005 job_009: - name: "unit_test; linux; Dart stable; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test --total-shards 3 --shard-index 0`, `dart test --total-shards 3 --shard-index 1`, `dart test --total-shards 3 --shard-index 2`" + name: "unit_test; linux; Dart stable; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds;commands:command-test_2-test_3-test_4" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds;commands:command-test_2" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds os:ubuntu-latest;pub-cache-hosted;sdk:stable @@ -390,16 +382,8 @@ jobs: run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds - - name: "dwds; dart test --total-shards 3 --shard-index 0" - run: dart test --total-shards 3 --shard-index 0 - if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" - working-directory: dwds - - name: "dwds; dart test --total-shards 3 --shard-index 1" - run: dart test --total-shards 3 --shard-index 1 - if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" - working-directory: dwds - - name: "dwds; dart test --total-shards 3 --shard-index 2" - run: dart test --total-shards 3 --shard-index 2 + - name: dwds; dart test + run: dart test if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds needs: @@ -416,7 +400,7 @@ jobs: uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:frontend_server_client;commands:test_6" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:frontend_server_client;commands:test_3" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:frontend_server_client os:ubuntu-latest;pub-cache-hosted;sdk:stable @@ -452,7 +436,7 @@ jobs: uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:webdev;commands:command-test_6" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:webdev;commands:command-test_3" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:webdev os:ubuntu-latest;pub-cache-hosted;sdk:stable @@ -649,7 +633,7 @@ jobs: uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds;commands:command-test_6" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds;commands:command-test_3" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds os:ubuntu-latest;pub-cache-hosted;sdk:beta @@ -702,7 +686,7 @@ jobs: uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev;commands:command-test_6" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev;commands:command-test_3" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev os:ubuntu-latest;pub-cache-hosted;sdk:beta diff --git a/dwds/mono_pkg.yaml b/dwds/mono_pkg.yaml index 59fad9bf3..5e2ccaf7f 100644 --- a/dwds/mono_pkg.yaml +++ b/dwds/mono_pkg.yaml @@ -13,9 +13,7 @@ stages: - unit_test: - group: - command: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - - test: --total-shards 3 --shard-index 0 - - test: --total-shards 3 --shard-index 1 - - test: --total-shards 3 --shard-index 2 + - test: sdk: - dev - stable diff --git a/tool/ci.sh b/tool/ci.sh index 51e3bc6b6..ded8bb85b 100755 --- a/tool/ci.sh +++ b/tool/ci.sh @@ -92,26 +92,14 @@ for PKG in ${PKGS}; do dart test test/build/min_sdk_test.dart --run-skipped || EXIT_CODE=$? ;; test_2) - echo 'dart test --total-shards 3 --shard-index 0' - dart test --total-shards 3 --shard-index 0 || EXIT_CODE=$? - ;; - test_3) - echo 'dart test --total-shards 3 --shard-index 1' - dart test --total-shards 3 --shard-index 1 || EXIT_CODE=$? - ;; - test_4) - echo 'dart test --total-shards 3 --shard-index 2' - dart test --total-shards 3 --shard-index 2 || EXIT_CODE=$? - ;; - test_5) echo 'dart test' dart test || EXIT_CODE=$? ;; - test_6) + test_3) echo 'dart test -j 1' dart test -j 1 || EXIT_CODE=$? ;; - test_7) + test_4) echo 'dart test test/build/ensure_build_test.dart' dart test test/build/ensure_build_test.dart || EXIT_CODE=$? ;; From 1b9cd49b8928edc2aff43d8dc12cd8689052900b Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 19 Dec 2022 20:10:29 -0800 Subject: [PATCH 08/26] Add another assert --- dwds/test/fixtures/context.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index fef612859..996bc02fd 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -150,6 +150,8 @@ class TestContext { }) { final isSoundPackage = packageName.toLowerCase().contains('sound'); assert(nullSafety == NullSafety.sound ? isSoundPackage : !isSoundPackage); + assert(p.current.endsWith('dwds')); + workingDirectory = testFixturesAbsolutePath([packageName]); DartUri.currentDirectory = workingDirectory; From c829bb69fb57732b4885c7797cf357fa247b6071 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 10:04:56 -0800 Subject: [PATCH 09/26] Use helper function in dart_uri_file_uri_test --- dwds/test/dart_uri_file_uri_test.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 1139c4d07..407fb96fb 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -22,10 +22,7 @@ final context = TestContext.withWeakNullSafety( final dwdsDir = Directory.current.absolute.path; /// The directory for the general _test package. -final testDir = p.normalize(p.absolute(p.relative( - p.join('..', 'fixtures', '_test'), - from: p.current, -))); +final testDir = testFixturesAbsolutePath(['_test']); /// The directory for the _testPackage package (contained within dwds), which /// imports _test. From e08ad42eac806d69c4e688c29aa6314fd99442c6 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 11:14:36 -0800 Subject: [PATCH 10/26] More refactoring --- dwds/test/fixtures/context.dart | 114 +++++++++++++++++--------------- 1 file changed, 61 insertions(+), 53 deletions(-) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 8600e91c4..8bbfa05b0 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -55,6 +55,42 @@ enum IndexBaseMode { noBase, base } enum NullSafety { weak, sound } class TestContext { + final String packageName; + final String webAssetsPath; + final String dartEntryFileName; + final String htmlEntryFileName; + final NullSafety nullSafety; + + /// Top level directory in which we run the test server, e.g. + /// "/workstation/webdev/fixtures/_testSound". + String get workingDirectory => testFixturesAbsolutePath([packageName]); + + /// The directory to build and serve, e.g. "example". + String get directoryToServe => p.split(webAssetsPath).first; + + /// The path to the HTML file to serve, relative to the [directoryToServe], + /// e.g. "hello_world/index.html". + String get filePathToServe => p.relative( + p.join(webAssetsPath, htmlEntryFileName), + from: directoryToServe, + ); + + /// The entry file is the Dart entry file, e.g, + /// "/workstation/webdev/fixtures/_testSound/example/hello_world/main.dart": + File get _entryFile => File( + testFixturesAbsolutePath( + [packageName, ...p.split(webAssetsPath), dartEntryFileName], + ), + ); + + /// The contents of the Dart entry file: + String get _entryContents => _entryFile.readAsStringSync(); + + /// The URI for the package_config.json is located in: + /// /.dart_tool/package_config + Uri get _packageConfigFile => + p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); + String get appUrl => _appUrl!; late String? _appUrl; @@ -96,82 +132,56 @@ class TestContext { late WipConnection extensionConnection; late AppConnection appConnection; late DebugConnection debugConnection; - late File _entryFile; - late Uri _packageConfigFile; - late Uri _projectDirectory; - late String _entryContents; final _logger = logging.Logger('Context'); - /// Top level directory in which we run the test server. - late String workingDirectory; - - /// The directory to build and serve (eg, `example`). - late String directoryToServe; - - /// The path to the HTML file to serve, relative to the [directoryToServe] - /// (eg, `hello_world/index.html`). - late String filePathToServe; - - NullSafety nullSafety; - TestContext.withSoundNullSafety({ String packageName = '_testSound', - String webAssetsDirectoryName = 'example', - String dartEntryFilePath = 'hello_world/main.dart', - String htmlEntryFilePath = 'hello_world/index.html', + String webAssetsPath = 'example/hello_world', + String dartEntryFileName = 'main.dart', + String htmlEntryFileName = 'index.html', }) : this._( nullSafety: NullSafety.sound, packageName: packageName, - webAssetsDirectoryName: webAssetsDirectoryName, - dartEntryFilePath: dartEntryFilePath, - htmlEntryFilePath: htmlEntryFilePath, + webAssetsPath: webAssetsPath, + dartEntryFileName: dartEntryFileName, + htmlEntryFileName: htmlEntryFileName, ); TestContext.withWeakNullSafety({ String packageName = '_test', - String webAssetsDirectoryName = 'example', - String dartEntryFilePath = 'hello_world/main.dart', - String htmlEntryFilePath = 'hello_world/index.html', + String webAssetsPath = 'example/hello_world', + String dartEntryFileName = 'main.dart', + String htmlEntryFileName = 'index.html', }) : this._( nullSafety: NullSafety.weak, packageName: packageName, - webAssetsDirectoryName: webAssetsDirectoryName, - dartEntryFilePath: dartEntryFilePath, - htmlEntryFilePath: htmlEntryFilePath, + webAssetsPath: webAssetsPath, + dartEntryFileName: dartEntryFileName, + htmlEntryFileName: htmlEntryFileName, ); TestContext._({ - required String packageName, - required String webAssetsDirectoryName, - required String dartEntryFilePath, - required String htmlEntryFilePath, + required this.packageName, + required this.webAssetsPath, + required this.dartEntryFileName, + required this.htmlEntryFileName, required this.nullSafety, }) { + // Verify that the test fixtures package matches the null-safety mode: final isSoundPackage = packageName.toLowerCase().contains('sound'); assert(nullSafety == NullSafety.sound ? isSoundPackage : !isSoundPackage); + // Verify that the web assets path has no starting slash: + assert(!webAssetsPath.startsWith('/')); + // Verify that we are running the test from the DWDS directory: assert(p.current.endsWith('dwds')); - workingDirectory = testFixturesAbsolutePath([packageName]); DartUri.currentDirectory = workingDirectory; - // package_config.json is located in /.dart_tool/package_config - _projectDirectory = p.toUri(workingDirectory); - _packageConfigFile = - p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); - - directoryToServe = webAssetsDirectoryName; - filePathToServe = htmlEntryFilePath; - final entryFilePath = testFixturesAbsolutePath( - [packageName, webAssetsDirectoryName, ...p.split(dartEntryFilePath)], - ); _logger.info('Serving: $directoryToServe/$filePathToServe'); - _logger.info('Project: $_projectDirectory'); + _logger.info('Project: $workingDirectory'); _logger.info('Packages: $_packageConfigFile'); - _logger.info('Entry: $entryFilePath'); - - _entryFile = File(entryFilePath); - _entryContents = _entryFile.readAsStringSync(); + _logger.info('Entry: ${_entryFile.path}'); } Future setUp({ @@ -314,9 +324,7 @@ class TestContext { { _logger.warning('Index: $filePathToServe'); - final entry = p.toUri(_entryFile.path - .substring(_projectDirectory.toFilePath().length + 1)); - + final entry = p.toUri(p.join(webAssetsPath, dartEntryFileName)); final fileSystem = LocalFileSystem(); final packageUriMapper = await PackageUriMapper.create( fileSystem, @@ -327,10 +335,10 @@ class TestContext { _webRunner = ResidentWebRunner( entry, urlEncoder, - _projectDirectory, + p.toUri(workingDirectory), _packageConfigFile, packageUriMapper, - [_projectDirectory], + [p.toUri(workingDirectory)], 'org-dartlang-app', outputDir.path, nullSafety == NullSafety.sound, From bdc65aa5c28e58b96b766ce07563407787227b1c Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 11:53:46 -0800 Subject: [PATCH 11/26] Update tests --- dwds/test/build_daemon_breakpoint_test.dart | 6 +++--- dwds/test/build_daemon_callstack_test.dart | 12 ++++++------ dwds/test/dart_uri_file_uri_test.dart | 6 +++--- dwds/test/evaluate_circular_common.dart | 12 ++++++------ dwds/test/evaluate_common.dart | 12 ++++++------ dwds/test/frontend_server_breakpoint_test.dart | 6 +++--- dwds/test/frontend_server_callstack_test.dart | 12 ++++++------ dwds/test/inspector_test.dart | 5 +++-- dwds/test/instance_test.dart | 5 +++-- dwds/test/reload_test.dart | 5 +++-- dwds/test/variable_scope_test.dart | 5 +++-- 11 files changed, 45 insertions(+), 41 deletions(-) diff --git a/dwds/test/build_daemon_breakpoint_test.dart b/dwds/test/build_daemon_breakpoint_test.dart index 520192001..299288e35 100644 --- a/dwds/test/build_daemon_breakpoint_test.dart +++ b/dwds/test/build_daemon_breakpoint_test.dart @@ -15,9 +15,9 @@ import 'fixtures/context.dart'; final context = TestContext.withSoundNullSafety( packageName: '_testPackageSound', - webAssetsDirectoryName: 'web', - dartEntryFilePath: 'main.dart', - htmlEntryFilePath: 'index.html', + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: 'index.html', ); ChromeProxyService get service => diff --git a/dwds/test/build_daemon_callstack_test.dart b/dwds/test/build_daemon_callstack_test.dart index 7b30ef4c0..d4a2a8dab 100644 --- a/dwds/test/build_daemon_callstack_test.dart +++ b/dwds/test/build_daemon_callstack_test.dart @@ -18,16 +18,16 @@ import 'utils/version_compatibility.dart'; class TestSetup { static final contextUnsound = TestContext.withWeakNullSafety( packageName: '_testPackage', - dartEntryFilePath: 'main.dart', - htmlEntryFilePath: 'index.html', - webAssetsDirectoryName: 'web', + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: 'index.html', ); static final contextSound = TestContext.withSoundNullSafety( packageName: '_testPackageSound', - dartEntryFilePath: 'main.dart', - htmlEntryFilePath: 'index.html', - webAssetsDirectoryName: 'web', + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: 'index.html', ); TestContext context; diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 407fb96fb..078c9f04f 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -14,9 +14,9 @@ import 'utils/version_compatibility.dart'; final context = TestContext.withWeakNullSafety( packageName: '_testPackage', - webAssetsDirectoryName: 'web', - dartEntryFilePath: 'main.dart', - htmlEntryFilePath: 'index.html', + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: 'index.html', ); final dwdsDir = Directory.current.absolute.path; diff --git a/dwds/test/evaluate_circular_common.dart b/dwds/test/evaluate_circular_common.dart index 5c37a4bc5..ec86d2318 100644 --- a/dwds/test/evaluate_circular_common.dart +++ b/dwds/test/evaluate_circular_common.dart @@ -18,17 +18,17 @@ class TestSetup { static TestContext contextUnsound(String index) => TestContext.withWeakNullSafety( packageName: '_testCircular2', - webAssetsDirectoryName: 'web', - dartEntryFilePath: 'main.dart', - htmlEntryFilePath: index, + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: index, ); static TestContext contextSound(String index) => TestContext.withSoundNullSafety( packageName: '_testCircular2Sound', - webAssetsDirectoryName: 'web', - dartEntryFilePath: 'main.dart', - htmlEntryFilePath: index, + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: index, ); TestContext context; diff --git a/dwds/test/evaluate_common.dart b/dwds/test/evaluate_common.dart index 053f4ce15..7f580d200 100644 --- a/dwds/test/evaluate_common.dart +++ b/dwds/test/evaluate_common.dart @@ -18,17 +18,17 @@ class TestSetup { static TestContext contextUnsound(String index) => TestContext.withWeakNullSafety( packageName: '_testPackage', - webAssetsDirectoryName: 'web', - dartEntryFilePath: 'main.dart', - htmlEntryFilePath: index, + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: index, ); static TestContext contextSound(String index) => TestContext.withSoundNullSafety( packageName: '_testPackageSound', - webAssetsDirectoryName: 'web', - dartEntryFilePath: 'main.dart', - htmlEntryFilePath: index, + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: index, ); TestContext context; diff --git a/dwds/test/frontend_server_breakpoint_test.dart b/dwds/test/frontend_server_breakpoint_test.dart index 7122e06c4..411b03c59 100644 --- a/dwds/test/frontend_server_breakpoint_test.dart +++ b/dwds/test/frontend_server_breakpoint_test.dart @@ -17,9 +17,9 @@ import 'utils/version_compatibility.dart'; final context = TestContext.withWeakNullSafety( packageName: '_testPackage', - webAssetsDirectoryName: 'web', - htmlEntryFilePath: 'index.html', - dartEntryFilePath: 'main.dart', + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: 'index.html', ); ChromeProxyService get service => diff --git a/dwds/test/frontend_server_callstack_test.dart b/dwds/test/frontend_server_callstack_test.dart index 7a75e74f3..ccd3405e6 100644 --- a/dwds/test/frontend_server_callstack_test.dart +++ b/dwds/test/frontend_server_callstack_test.dart @@ -18,16 +18,16 @@ import 'utils/version_compatibility.dart'; class TestSetup { static final contextUnsound = TestContext.withWeakNullSafety( packageName: '_testPackage', - webAssetsDirectoryName: 'web', - htmlEntryFilePath: 'index.html', - dartEntryFilePath: 'main.dart', + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: 'index.html', ); static final contextSound = TestContext.withSoundNullSafety( packageName: '_testPackageSound', - webAssetsDirectoryName: 'web', - htmlEntryFilePath: 'index.html', - dartEntryFilePath: 'main.dart', + webAssetsPath: 'web', + dartEntryFileName: 'main.dart', + htmlEntryFileName: 'index.html', ); TestContext context; diff --git a/dwds/test/inspector_test.dart b/dwds/test/inspector_test.dart index 6b3e28290..7596fb0a9 100644 --- a/dwds/test/inspector_test.dart +++ b/dwds/test/inspector_test.dart @@ -16,8 +16,9 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; final context = TestContext.withSoundNullSafety( - dartEntryFilePath: 'scopes/scopes_main.dart', - htmlEntryFilePath: 'scopes/scopes.html', + webAssetsPath: 'example/scopes', + dartEntryFileName: 'scopes_main.dart', + htmlEntryFileName: 'scopes.html', ); WipConnection get tabConnection => context.tabConnection; diff --git a/dwds/test/instance_test.dart b/dwds/test/instance_test.dart index 6e0d93e3a..7d502f904 100644 --- a/dwds/test/instance_test.dart +++ b/dwds/test/instance_test.dart @@ -15,8 +15,9 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; final context = TestContext.withSoundNullSafety( - dartEntryFilePath: 'scopes/scopes_main.dart', - htmlEntryFilePath: 'scopes/scopes.html', + webAssetsPath: 'example/scopes', + dartEntryFileName: 'scopes_main.dart', + htmlEntryFileName: 'scopes.html', ); WipConnection get tabConnection => context.tabConnection; diff --git a/dwds/test/reload_test.dart b/dwds/test/reload_test.dart index 5d0ea82c8..ad6ed5667 100644 --- a/dwds/test/reload_test.dart +++ b/dwds/test/reload_test.dart @@ -12,8 +12,9 @@ import 'fixtures/context.dart'; import 'fixtures/logging.dart'; final context = TestContext.withSoundNullSafety( - dartEntryFilePath: 'append_body/main.dart', - htmlEntryFilePath: 'append_body/index.html', + webAssetsPath: 'example/append_body', + dartEntryFileName: 'main.dart', + htmlEntryFileName: 'index.html', ); void main() { diff --git a/dwds/test/variable_scope_test.dart b/dwds/test/variable_scope_test.dart index 4e0df70bf..931039b31 100644 --- a/dwds/test/variable_scope_test.dart +++ b/dwds/test/variable_scope_test.dart @@ -13,8 +13,9 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; final context = TestContext.withSoundNullSafety( - dartEntryFilePath: 'scopes/scopes_main.dart', - htmlEntryFilePath: 'scopes/scopes.html', + webAssetsPath: 'example/scopes', + dartEntryFileName: 'scopes_main.dart', + htmlEntryFileName: 'scopes.html', ); ChromeProxyService get service => fetchChromeProxyService(context.debugConnection); From 1093a49065390d844b2dfedb4c438fd803c8d210 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:02:51 -0800 Subject: [PATCH 12/26] Restore files changed by running mono_repo generate --- .github/workflows/dart.yml | 320 ++++++++++++++++--------------------- tool/ci.sh | 2 +- 2 files changed, 138 insertions(+), 184 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 9ce5a72ae..f5dd9565e 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -1,4 +1,4 @@ -# Created with package:mono_repo v6.4.2 +# Created with package:mono_repo v6.3.0 name: Dart CI on: push: @@ -22,22 +22,20 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable" restore-keys: | os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - name: mono_repo self validate - run: dart pub global activate mono_repo 6.4.2 + run: dart pub global activate mono_repo 6.3.0 - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: @@ -45,7 +43,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:format-analyze_0-test_0" @@ -54,36 +52,34 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: dwds_pub_upgrade name: dwds; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds + run: dart pub upgrade - name: "dwds; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: "dart format --output=none --set-exit-if-changed ." - name: "dwds; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart analyze --fatal-infos . - name: dwds; dart test test/build/ensure_version_test.dart - run: dart test test/build/ensure_version_test.dart if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart test test/build/ensure_version_test.dart job_003: name: "analyzer_and_format; linux; Dart dev; PKGS: example, fixtures/_webdevSmoke, frontend_server_client, frontend_server_common; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:example-fixtures/_webdevSmoke-frontend_server_client-frontend_server_common;commands:format-analyze_0" @@ -92,71 +88,69 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: example_pub_upgrade name: example; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: example + run: dart pub upgrade - name: "example; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.example_pub_upgrade.conclusion == 'success'" working-directory: example + run: "dart format --output=none --set-exit-if-changed ." - name: "example; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . if: "always() && steps.example_pub_upgrade.conclusion == 'success'" working-directory: example + run: dart analyze --fatal-infos . - id: fixtures__webdevSmoke_pub_upgrade name: fixtures/_webdevSmoke; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: fixtures/_webdevSmoke + run: dart pub upgrade - name: "fixtures/_webdevSmoke; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.fixtures__webdevSmoke_pub_upgrade.conclusion == 'success'" working-directory: fixtures/_webdevSmoke + run: "dart format --output=none --set-exit-if-changed ." - name: "fixtures/_webdevSmoke; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . if: "always() && steps.fixtures__webdevSmoke_pub_upgrade.conclusion == 'success'" working-directory: fixtures/_webdevSmoke + run: dart analyze --fatal-infos . - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client + run: dart pub upgrade - name: "frontend_server_client; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client + run: "dart format --output=none --set-exit-if-changed ." - name: "frontend_server_client; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client + run: dart analyze --fatal-infos . - id: frontend_server_common_pub_upgrade name: frontend_server_common; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_common + run: dart pub upgrade - name: "frontend_server_common; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.frontend_server_common_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_common + run: "dart format --output=none --set-exit-if-changed ." - name: "frontend_server_common; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . if: "always() && steps.frontend_server_common_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_common + run: dart analyze --fatal-infos . job_004: name: "analyzer_and_format; linux; Dart dev; PKG: webdev; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`, `dart test test/build/ensure_build_test.dart`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:format-analyze_0-test_4" @@ -165,36 +159,34 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: webdev_pub_upgrade name: webdev; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev + run: dart pub upgrade - name: "webdev; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: "dart format --output=none --set-exit-if-changed ." - name: "webdev; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart analyze --fatal-infos . - name: webdev; dart test test/build/ensure_build_test.dart - run: dart test test/build/ensure_build_test.dart if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart test test/build/ensure_build_test.dart job_005: name: "analyzer_and_format; linux; Dart stable; PKGS: dwds, webdev; `dart analyze .`, `dart test test/build/min_sdk_test.dart --run-skipped`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds-webdev;commands:analyze_1-test_1" @@ -203,45 +195,43 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: dwds_pub_upgrade name: dwds; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds + run: dart pub upgrade - name: dwds; dart analyze . - run: dart analyze . if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart analyze . - name: "dwds; dart test test/build/min_sdk_test.dart --run-skipped" - run: dart test test/build/min_sdk_test.dart --run-skipped if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart test test/build/min_sdk_test.dart --run-skipped - id: webdev_pub_upgrade name: webdev; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev + run: dart pub upgrade - name: webdev; dart analyze . - run: dart analyze . if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart analyze . - name: "webdev; dart test test/build/min_sdk_test.dart --run-skipped" - run: dart test test/build/min_sdk_test.dart --run-skipped if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart test test/build/min_sdk_test.dart --run-skipped job_006: name: "unit_test; linux; Dart dev; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:command-test_2" @@ -250,26 +240,24 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: dwds_pub_upgrade name: dwds; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds + run: dart pub upgrade - name: "dwds; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: dwds; dart test - run: dart test if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart test needs: - job_001 - job_002 @@ -281,7 +269,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:frontend_server_client;commands:test_3" @@ -290,22 +278,20 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client + run: dart pub upgrade - name: "frontend_server_client; dart test -j 1" - run: dart test -j 1 if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client + run: dart test -j 1 needs: - job_001 - job_002 @@ -317,7 +303,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:command-test_3" @@ -326,26 +312,24 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: webdev_pub_upgrade name: webdev; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev + run: dart pub upgrade - name: "webdev; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: "webdev; dart test -j 1" - run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart test -j 1 needs: - job_001 - job_002 @@ -357,7 +341,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds;commands:command-test_2" @@ -366,26 +350,24 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: dwds_pub_upgrade name: dwds; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds + run: dart pub upgrade - name: "dwds; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: dwds; dart test - run: dart test if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart test needs: - job_001 - job_002 @@ -397,7 +379,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:frontend_server_client;commands:test_3" @@ -406,22 +388,20 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client + run: dart pub upgrade - name: "frontend_server_client; dart test -j 1" - run: dart test -j 1 if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client + run: dart test -j 1 needs: - job_001 - job_002 @@ -433,7 +413,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:webdev;commands:command-test_3" @@ -442,26 +422,24 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: webdev_pub_upgrade name: webdev; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev + run: dart pub upgrade - name: "webdev; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: "webdev; dart test -j 1" - run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart test -j 1 needs: - job_001 - job_002 @@ -472,22 +450,20 @@ jobs: name: "unit_test; windows; Dart dev; PKG: dwds; `dart test`" runs-on: windows-latest steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: dwds_pub_upgrade name: dwds; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds + run: dart pub upgrade - name: dwds; dart test - run: dart test if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart test needs: - job_001 - job_002 @@ -498,22 +474,20 @@ jobs: name: "unit_test; windows; Dart dev; PKG: frontend_server_client; `dart test -j 1`" runs-on: windows-latest steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client + run: dart pub upgrade - name: "frontend_server_client; dart test -j 1" - run: dart test -j 1 if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client + run: dart test -j 1 needs: - job_001 - job_002 @@ -524,22 +498,20 @@ jobs: name: "unit_test; windows; Dart dev; PKG: webdev; `dart test -j 1`" runs-on: windows-latest steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: dev - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: webdev_pub_upgrade name: webdev; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev + run: dart pub upgrade - name: "webdev; dart test -j 1" - run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart test -j 1 needs: - job_001 - job_002 @@ -550,22 +522,20 @@ jobs: name: "unit_test; windows; Dart stable; PKG: dwds; `dart test`" runs-on: windows-latest steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: dwds_pub_upgrade name: dwds; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds + run: dart pub upgrade - name: dwds; dart test - run: dart test if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart test needs: - job_001 - job_002 @@ -576,22 +546,20 @@ jobs: name: "unit_test; windows; Dart stable; PKG: frontend_server_client; `dart test -j 1`" runs-on: windows-latest steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: frontend_server_client + run: dart pub upgrade - name: "frontend_server_client; dart test -j 1" - run: dart test -j 1 if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'" working-directory: frontend_server_client + run: dart test -j 1 needs: - job_001 - job_002 @@ -602,22 +570,20 @@ jobs: name: "unit_test; windows; Dart stable; PKG: webdev; `dart test -j 1`" runs-on: windows-latest steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: stable - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: webdev_pub_upgrade name: webdev; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev + run: dart pub upgrade - name: "webdev; dart test -j 1" - run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart test -j 1 needs: - job_001 - job_002 @@ -627,10 +593,9 @@ jobs: job_018: name: "beta_cron; linux; Dart beta; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test -j 1`" runs-on: ubuntu-latest - if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds;commands:command-test_3" @@ -639,26 +604,25 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:beta os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: dwds_pub_upgrade name: dwds; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds + run: dart pub upgrade - name: "dwds; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: "dwds; dart test -j 1" - run: dart test -j 1 if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart test -j 1 + if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -680,10 +644,9 @@ jobs: job_019: name: "beta_cron; linux; Dart beta; PKG: webdev; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test -j 1`" runs-on: ubuntu-latest - if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev;commands:command-test_3" @@ -692,26 +655,25 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:beta os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: webdev_pub_upgrade name: webdev; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev + run: dart pub upgrade - name: "webdev; Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &" - name: "webdev; dart test -j 1" - run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart test -j 1 + if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -733,10 +695,9 @@ jobs: job_020: name: "beta_cron; linux; Dart beta; PKG: dwds; `dart analyze .`" runs-on: ubuntu-latest - if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds;commands:analyze_1" @@ -745,22 +706,21 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:beta os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: dwds_pub_upgrade name: dwds; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds + run: dart pub upgrade - name: dwds; dart analyze . - run: dart analyze . if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart analyze . + if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -782,10 +742,9 @@ jobs: job_021: name: "beta_cron; linux; Dart beta; PKG: webdev; `dart analyze .`" runs-on: ubuntu-latest - if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev;commands:analyze_1" @@ -794,22 +753,21 @@ jobs: os:ubuntu-latest;pub-cache-hosted;sdk:beta os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: webdev_pub_upgrade name: webdev; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev + run: dart pub upgrade - name: webdev; dart analyze . - run: dart analyze . if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart analyze . + if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -831,24 +789,22 @@ jobs: job_022: name: "beta_cron; windows; Dart beta; PKG: dwds; `dart test -j 1`" runs-on: windows-latest - if: "github.event_name == 'schedule'" steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: dwds_pub_upgrade name: dwds; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: dwds + run: dart pub upgrade - name: "dwds; dart test -j 1" - run: dart test -j 1 if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds + run: dart test -j 1 + if: "github.event_name == 'schedule'" needs: - job_001 - job_002 @@ -870,24 +826,22 @@ jobs: job_023: name: "beta_cron; windows; Dart beta; PKG: webdev; `dart test -j 1`" runs-on: windows-latest - if: "github.event_name == 'schedule'" steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: beta - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 - id: webdev_pub_upgrade name: webdev; dart pub upgrade - run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: webdev + run: dart pub upgrade - name: "webdev; dart test -j 1" - run: dart test -j 1 if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'" working-directory: webdev + run: dart test -j 1 + if: "github.event_name == 'schedule'" needs: - job_001 - job_002 diff --git a/tool/ci.sh b/tool/ci.sh index ded8bb85b..bb144cd12 100755 --- a/tool/ci.sh +++ b/tool/ci.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Created with package:mono_repo v6.4.2 +# Created with package:mono_repo v6.3.0 # Support built in commands on windows out of the box. # When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") From 6977a218a1b6a41d78c55facee3ddeeaf3a276c3 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:15:30 -0800 Subject: [PATCH 13/26] Use helper function in package_mapper_uri_test --- dwds/test/package_uri_mapper_test.dart | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dwds/test/package_uri_mapper_test.dart b/dwds/test/package_uri_mapper_test.dart index 178a5b85e..ecff03432 100644 --- a/dwds/test/package_uri_mapper_test.dart +++ b/dwds/test/package_uri_mapper_test.dart @@ -11,6 +11,8 @@ import 'package:file/local.dart'; import 'package:path/path.dart' as p; import 'package:test/test.dart'; +import 'fixtures/context.dart'; + void main() { for (final useDebuggerModuleNames in [true, false]) { group( @@ -28,11 +30,8 @@ void main() { final resolvedPath = '/webdev/fixtures/_testPackageSound/lib/test_library.dart'; - final testPackageSoundPath = p.normalize(p.absolute(p.join( - '..', - 'fixtures', - '_testPackageSound', - ))); + final testPackageSoundPath = + testFixturesAbsolutePath(['_testPackageSound']); final packageConfigFile = Uri.file(p.join( testPackageSoundPath, From 7319bd7d549b6ecc67285327f38cbab9924bb067 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 13:49:56 -0800 Subject: [PATCH 14/26] Merge in changes from other PR --- dwds/test/debug_extension_test.dart | 2 +- dwds/test/devtools_test.dart | 1 + dwds/test/fixtures/context.dart | 41 ++++++++++++++++---------- dwds/test/package_uri_mapper_test.dart | 4 ++- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/dwds/test/debug_extension_test.dart b/dwds/test/debug_extension_test.dart index 328e03d52..e05e8cceb 100644 --- a/dwds/test/debug_extension_test.dart +++ b/dwds/test/debug_extension_test.dart @@ -5,7 +5,7 @@ // When run locally this test may require a manifest key. This makes it easy to // just skip it. @Tags(['extension']) -@Timeout(Duration(seconds: 60)) +@Timeout(Duration(minutes: 2)) @OnPlatform({ 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), }) diff --git a/dwds/test/devtools_test.dart b/dwds/test/devtools_test.dart index 6e7030772..66422ce7f 100644 --- a/dwds/test/devtools_test.dart +++ b/dwds/test/devtools_test.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@Skip('https://github.com/dart-lang/webdev/issues/1845 - Move to cron job.') @Timeout(Duration(minutes: 5)) @TestOn('vm') import 'dart:io'; diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 8bbfa05b0..aaf8dedaf 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -61,9 +61,18 @@ class TestContext { final String htmlEntryFileName; final NullSafety nullSafety; + /// The path to DWDS, e.g. "/workstation/webdev/dwds". + String get dwdsPath { + assert(p.current.contains('dwds')); + final pathParts = p.split(p.current); + return p.joinAll( + pathParts.sublist(0, pathParts.indexOf('dwds') + 1), + ); + } + /// Top level directory in which we run the test server, e.g. /// "/workstation/webdev/fixtures/_testSound". - String get workingDirectory => testFixturesAbsolutePath([packageName]); + String get workingDirectory => testFixturesAbsolutePath(packageName); /// The directory to build and serve, e.g. "example". String get directoryToServe => p.split(webAssetsPath).first; @@ -79,7 +88,7 @@ class TestContext { /// "/workstation/webdev/fixtures/_testSound/example/hello_world/main.dart": File get _entryFile => File( testFixturesAbsolutePath( - [packageName, ...p.split(webAssetsPath), dartEntryFileName], + p.joinAll([packageName, webAssetsPath, dartEntryFileName]), ), ); @@ -173,8 +182,8 @@ class TestContext { assert(nullSafety == NullSafety.sound ? isSoundPackage : !isSoundPackage); // Verify that the web assets path has no starting slash: assert(!webAssetsPath.startsWith('/')); - // Verify that we are running the test from the DWDS directory: - assert(p.current.endsWith('dwds')); + // Verify that we are running the test from a DWDS directory: + assert(p.current.contains('dwds')); DartUri.currentDirectory = workingDirectory; @@ -456,6 +465,18 @@ class TestContext { } } + String testFixturesAbsolutePath(String fixturesPath) => p.normalize( + p.absolute( + p.relative( + p.join( + '..', + 'fixtures', + fixturesPath, + ), + from: dwdsPath), + ), + ); + Future startDebugging() async { debugConnection = await testServer.dwds.debugConnection(appConnection); _webkitDebugger = WebkitDebugger(WipDebugger(tabConnection)); @@ -551,15 +572,3 @@ class TestContext { return lineNumber + 1; } } - -String testFixturesAbsolutePath(List relativePathParts) => p.normalize( - p.absolute( - p.relative( - p.join( - '..', - 'fixtures', - p.joinAll(relativePathParts), - ), - from: p.current), - ), - ); diff --git a/dwds/test/package_uri_mapper_test.dart b/dwds/test/package_uri_mapper_test.dart index ecff03432..444446fd8 100644 --- a/dwds/test/package_uri_mapper_test.dart +++ b/dwds/test/package_uri_mapper_test.dart @@ -13,6 +13,8 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; +final context = TestContext.withSoundNullSafety(); + void main() { for (final useDebuggerModuleNames in [true, false]) { group( @@ -31,7 +33,7 @@ void main() { '/webdev/fixtures/_testPackageSound/lib/test_library.dart'; final testPackageSoundPath = - testFixturesAbsolutePath(['_testPackageSound']); + context.testFixturesAbsolutePath('_testPackageSound'); final packageConfigFile = Uri.file(p.join( testPackageSoundPath, From e972f329d89f8fb99502c2ee983e593588840b0f Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 13:50:13 -0800 Subject: [PATCH 15/26] Merge in changes from other PR --- dwds/test/dart_uri_file_uri_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 078c9f04f..53c258d42 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -22,7 +22,7 @@ final context = TestContext.withWeakNullSafety( final dwdsDir = Directory.current.absolute.path; /// The directory for the general _test package. -final testDir = testFixturesAbsolutePath(['_test']); +final testDir = context.testFixturesAbsolutePath('_test'); /// The directory for the _testPackage package (contained within dwds), which /// imports _test. From 14d66e0ba43cfd99ab91a26ff42b05171139b264 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 14:11:05 -0800 Subject: [PATCH 16/26] Update how we compute the DWDS path --- dwds/test/fixtures/context.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index aaf8dedaf..471190a55 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -63,11 +63,14 @@ class TestContext { /// The path to DWDS, e.g. "/workstation/webdev/dwds". String get dwdsPath { - assert(p.current.contains('dwds')); + final currentPath = p.current; + if (!currentPath.contains('webdev')) { + throw Exception( + 'Expected to be in /webdev, instead path is $currentPath'); + } final pathParts = p.split(p.current); return p.joinAll( - pathParts.sublist(0, pathParts.indexOf('dwds') + 1), - ); + [...pathParts.sublist(0, pathParts.lastIndexOf('webdev') + 1), 'dwds']); } /// Top level directory in which we run the test server, e.g. From d3181981682e16c3b835f3aac16744a608af3dc2 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 14:15:47 -0800 Subject: [PATCH 17/26] Small cleanup for dwds path --- dwds/test/fixtures/context.dart | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 471190a55..152e5f146 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -61,18 +61,6 @@ class TestContext { final String htmlEntryFileName; final NullSafety nullSafety; - /// The path to DWDS, e.g. "/workstation/webdev/dwds". - String get dwdsPath { - final currentPath = p.current; - if (!currentPath.contains('webdev')) { - throw Exception( - 'Expected to be in /webdev, instead path is $currentPath'); - } - final pathParts = p.split(p.current); - return p.joinAll( - [...pathParts.sublist(0, pathParts.lastIndexOf('webdev') + 1), 'dwds']); - } - /// Top level directory in which we run the test server, e.g. /// "/workstation/webdev/fixtures/_testSound". String get workingDirectory => testFixturesAbsolutePath(packageName); @@ -103,6 +91,18 @@ class TestContext { Uri get _packageConfigFile => p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); + /// The path to DWDS, e.g. "/workstation/webdev/dwds". + String get _dwdsPath { + final currentPath = p.current; + if (!currentPath.contains('webdev')) { + throw Exception( + 'Expected to be in a subdirectory of /webdev, instead path is $currentPath'); + } + final pathParts = p.split(currentPath); + return p.joinAll( + [...pathParts.sublist(0, pathParts.lastIndexOf('webdev') + 1), 'dwds']); + } + String get appUrl => _appUrl!; late String? _appUrl; @@ -185,8 +185,6 @@ class TestContext { assert(nullSafety == NullSafety.sound ? isSoundPackage : !isSoundPackage); // Verify that the web assets path has no starting slash: assert(!webAssetsPath.startsWith('/')); - // Verify that we are running the test from a DWDS directory: - assert(p.current.contains('dwds')); DartUri.currentDirectory = workingDirectory; @@ -476,7 +474,7 @@ class TestContext { 'fixtures', fixturesPath, ), - from: dwdsPath), + from: _dwdsPath), ), ); From 47bf0199c271f08b2e9f96aba3f01b6002180645 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 20 Dec 2022 14:52:19 -0800 Subject: [PATCH 18/26] Update test fixtures absolute path --- dwds/test/fixtures/context.dart | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 152e5f146..0297176fd 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -468,13 +468,12 @@ class TestContext { String testFixturesAbsolutePath(String fixturesPath) => p.normalize( p.absolute( - p.relative( - p.join( - '..', - 'fixtures', - fixturesPath, - ), - from: _dwdsPath), + p.join( + _dwdsPath, + '..', + 'fixtures', + fixturesPath, + ), ), ); From 37b35e6d72ac8cbbfe330e60ef9e46283049f182 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 21 Dec 2022 11:20:44 -0800 Subject: [PATCH 19/26] Switch to using pathFromFixtures where relevant --- dwds/test/dart_uri_file_uri_test.dart | 5 ++--- dwds/test/package_uri_mapper_test.dart | 8 ++------ dwds/test/readers/frontend_server_asset_reader_test.dart | 4 +--- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 8d39684ee..8785c89b0 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -20,12 +20,11 @@ final context = TestContext.withWeakNullSafety( ); /// The directory for the general _test package. -final testDir = absolutePath(pathFromDwds: p.join('..', 'fixtures', '_test')); +final testDir = absolutePath(pathFromFixtures: p.join('_test')); /// The directory for the _testPackage package (contained within dwds), which /// imports _test. -final testPackageDir = - absolutePath(pathFromDwds: p.join('..', 'fixtures', '_testPackage')); +final testPackageDir = absolutePath(pathFromFixtures: p.join('_testPackage')); // This tests converting file Uris into our internal paths. // diff --git a/dwds/test/package_uri_mapper_test.dart b/dwds/test/package_uri_mapper_test.dart index 5622f8f32..bb25ecb5f 100644 --- a/dwds/test/package_uri_mapper_test.dart +++ b/dwds/test/package_uri_mapper_test.dart @@ -30,12 +30,8 @@ void main() { final resolvedPath = '/webdev/fixtures/_testPackageSound/lib/test_library.dart'; - final testPackageSoundPath = absolutePath( - pathFromDwds: p.join( - '..', - 'fixtures', - '_testPackageSound', - )); + final testPackageSoundPath = + absolutePath(pathFromFixtures: '_testPackageSound'); final packageConfigFile = Uri.file(p.join( testPackageSoundPath, diff --git a/dwds/test/readers/frontend_server_asset_reader_test.dart b/dwds/test/readers/frontend_server_asset_reader_test.dart index c083808a0..10f780d92 100644 --- a/dwds/test/readers/frontend_server_asset_reader_test.dart +++ b/dwds/test/readers/frontend_server_asset_reader_test.dart @@ -13,9 +13,7 @@ import '../fixtures/context.dart'; import '../fixtures/utilities.dart'; import '../utils/version_compatibility.dart'; -final packagesDir = absolutePath( - pathFromDwds: p.join('..', 'fixtures', '_test'), -); +final packagesDir = absolutePath(pathFromFixtures: '_test'); final fixturesDir = absolutePath(pathFromDwds: p.join('test', 'fixtures')); From 58a145845a5ae11f7527eb62afee324f010f9df0 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 21 Dec 2022 17:20:26 -0800 Subject: [PATCH 20/26] Add some logging to try to understand failures --- dwds/lib/src/readers/proxy_server_asset_reader.dart | 1 + dwds/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dwds/lib/src/readers/proxy_server_asset_reader.dart b/dwds/lib/src/readers/proxy_server_asset_reader.dart index 960809eca..01dae783b 100644 --- a/dwds/lib/src/readers/proxy_server_asset_reader.dart +++ b/dwds/lib/src/readers/proxy_server_asset_reader.dart @@ -45,6 +45,7 @@ class ProxyServerAssetReader implements AssetReader { _readResource(serverPath); Future _readResource(String path) async { + print('READING RESOURCE AT $path'); // Handlers expect a fully formed HTML URI. The actual hostname and port // does not matter. final response = diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml index b26b45cf8..cd875fd04 100644 --- a/dwds/pubspec.yaml +++ b/dwds/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: path: ^1.8.1 pool: ^1.5.0 pub_semver: ^2.1.1 - shelf: ^1.3.0 + shelf: ^1.4.0 shelf_packages_handler: '^3.0.0' shelf_proxy: ^1.0.1 shelf_static: ^1.1.0 From 3661540f6e1aa3770cffa680519e6d4f9dd6e3c7 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 22 Dec 2022 10:07:41 -0800 Subject: [PATCH 21/26] Clean up --- dwds/lib/src/readers/proxy_server_asset_reader.dart | 1 - dwds/pubspec.yaml | 2 +- dwds/test/reload_test.dart | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dwds/lib/src/readers/proxy_server_asset_reader.dart b/dwds/lib/src/readers/proxy_server_asset_reader.dart index 01dae783b..960809eca 100644 --- a/dwds/lib/src/readers/proxy_server_asset_reader.dart +++ b/dwds/lib/src/readers/proxy_server_asset_reader.dart @@ -45,7 +45,6 @@ class ProxyServerAssetReader implements AssetReader { _readResource(serverPath); Future _readResource(String path) async { - print('READING RESOURCE AT $path'); // Handlers expect a fully formed HTML URI. The actual hostname and port // does not matter. final response = diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml index cd875fd04..b26b45cf8 100644 --- a/dwds/pubspec.yaml +++ b/dwds/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: path: ^1.8.1 pool: ^1.5.0 pub_semver: ^2.1.1 - shelf: ^1.4.0 + shelf: ^1.3.0 shelf_packages_handler: '^3.0.0' shelf_proxy: ^1.0.1 shelf_static: ^1.1.0 diff --git a/dwds/test/reload_test.dart b/dwds/test/reload_test.dart index ad6ed5667..54be98a71 100644 --- a/dwds/test/reload_test.dart +++ b/dwds/test/reload_test.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@Skip('https://github.com/dart-lang/webdev/issues/1845 - Move to cron job.') @TestOn('vm') @Timeout(Duration(minutes: 5)) import 'package:dwds/src/loaders/strategy.dart'; From d9ef0af8e4fe9754cb18915e19332059ea77758c Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 22 Dec 2022 11:28:14 -0800 Subject: [PATCH 22/26] Rename scopes_main --- dwds/test/inspector_test.dart | 18 +++++++++--------- dwds/test/instance_test.dart | 8 ++++---- dwds/test/variable_scope_test.dart | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dwds/test/inspector_test.dart b/dwds/test/inspector_test.dart index 7596fb0a9..577ba74ae 100644 --- a/dwds/test/inspector_test.dart +++ b/dwds/test/inspector_test.dart @@ -17,7 +17,7 @@ import 'fixtures/context.dart'; final context = TestContext.withSoundNullSafety( webAssetsPath: 'example/scopes', - dartEntryFileName: 'scopes_main.dart', + dartEntryFileName: 'main.dart', htmlEntryFileName: 'scopes.html', ); @@ -38,11 +38,11 @@ void main() { await context.tearDown(); }); - final url = 'org-dartlang-app:///example/scopes/scopes_main.dart'; + final url = 'org-dartlang-app:///example/scopes/main.dart'; /// A convenient way to get a library variable without boilerplate. String libraryVariableExpression(String variable) => - '${globalLoadStrategy.loadModuleSnippet}("dart_sdk").dart.getModuleLibraries("example/scopes/scopes_main")["$url"]["$variable"];'; + '${globalLoadStrategy.loadModuleSnippet}("dart_sdk").dart.getModuleLibraries("example/scopes/main")["$url"]["$variable"];'; Future libraryPublicFinal() => inspector.jsEvaluate(libraryVariableExpression('libraryPublicFinal')); @@ -228,27 +228,27 @@ void main() { } final jsMultiLineExceptionWithStackTrace = ''' -Error: Assertion failed: org-dartlang-app:///example/scopes/scopes_main.dart:4:11 +Error: Assertion failed: org-dartlang-app:///example/scopes/main.dart:4:11 false "THIS IS THE ASSERT MESSAGE" - at Object.assertFailed (org-dartlang-app:///example/scopes/scopes_main.dart.js:5297:15) + at Object.assertFailed (org-dartlang-app:///example/scopes/main.dart.js:5297:15) '''; final formattedMultiLineExceptionWithStackTrace = ''' -Error: Assertion failed: org-dartlang-app:///example/scopes/scopes_main.dart:4:11 +Error: Assertion failed: org-dartlang-app:///example/scopes/main.dart:4:11 false "THIS IS THE ASSERT MESSAGE" -org-dartlang-app:///example/scopes/scopes_main.dart.js 5297:15 assertFailed +org-dartlang-app:///example/scopes/main.dart.js 5297:15 assertFailed '''; final jsMultiLineExceptionNoStackTrace = ''' -Error: Assertion failed: org-dartlang-app:///example/scopes/scopes_main.dart:4:11 +Error: Assertion failed: org-dartlang-app:///example/scopes/main.dart:4:11 false "THIS IS THE ASSERT MESSAGE" '''; final formattedMultiLineExceptionNoStackTrace = ''' -Error: Assertion failed: org-dartlang-app:///example/scopes/scopes_main.dart:4:11 +Error: Assertion failed: org-dartlang-app:///example/scopes/main.dart:4:11 false "THIS IS THE ASSERT MESSAGE" '''; diff --git a/dwds/test/instance_test.dart b/dwds/test/instance_test.dart index 7d502f904..abaf35644 100644 --- a/dwds/test/instance_test.dart +++ b/dwds/test/instance_test.dart @@ -16,7 +16,7 @@ import 'fixtures/context.dart'; final context = TestContext.withSoundNullSafety( webAssetsPath: 'example/scopes', - dartEntryFileName: 'scopes_main.dart', + dartEntryFileName: 'main.dart', htmlEntryFileName: 'scopes.html', ); @@ -37,10 +37,10 @@ void main() { await context.tearDown(); }); - final url = 'org-dartlang-app:///example/scopes/scopes_main.dart'; + final url = 'org-dartlang-app:///example/scopes/main.dart'; String libraryVariableExpression(String variable) => - '${globalLoadStrategy.loadModuleSnippet}("dart_sdk").dart.getModuleLibraries("example/scopes/scopes_main")' + '${globalLoadStrategy.loadModuleSnippet}("dart_sdk").dart.getModuleLibraries("example/scopes/main")' '["$url"]["$variable"];'; /// A reference to the the variable `libraryPublicFinal`, an instance of @@ -84,7 +84,7 @@ void main() { expect(classRef.name, 'MyTestClass'); expect( classRef.id, - 'classes|org-dartlang-app:///example/scopes/scopes_main.dart' + 'classes|org-dartlang-app:///example/scopes/main.dart' '|MyTestClass'); }); diff --git a/dwds/test/variable_scope_test.dart b/dwds/test/variable_scope_test.dart index 931039b31..f2cd571f2 100644 --- a/dwds/test/variable_scope_test.dart +++ b/dwds/test/variable_scope_test.dart @@ -14,7 +14,7 @@ import 'fixtures/context.dart'; final context = TestContext.withSoundNullSafety( webAssetsPath: 'example/scopes', - dartEntryFileName: 'scopes_main.dart', + dartEntryFileName: 'main.dart', htmlEntryFileName: 'scopes.html', ); ChromeProxyService get service => @@ -116,7 +116,7 @@ void main() { await service.streamListen('Debug'); stream = service.onEvent('Debug'); mainScript = scripts.scripts! - .firstWhere((each) => each.uri!.contains('scopes_main.dart')); + .firstWhere((each) => each.uri!.contains('main.dart')); }); tearDown(() async { From 423e09df94321b116b851472c65347140b97bdca Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 22 Dec 2022 11:38:48 -0800 Subject: [PATCH 23/26] Committed in wrong directory --- fixtures/_test/example/scopes/{scopes_main.dart => main.dart} | 0 fixtures/_test/example/scopes/scopes.html | 2 +- .../_testSound/example/scopes/{scopes_main.dart => main.dart} | 0 fixtures/_testSound/example/scopes/scopes.html | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename fixtures/_test/example/scopes/{scopes_main.dart => main.dart} (100%) rename fixtures/_testSound/example/scopes/{scopes_main.dart => main.dart} (100%) diff --git a/fixtures/_test/example/scopes/scopes_main.dart b/fixtures/_test/example/scopes/main.dart similarity index 100% rename from fixtures/_test/example/scopes/scopes_main.dart rename to fixtures/_test/example/scopes/main.dart diff --git a/fixtures/_test/example/scopes/scopes.html b/fixtures/_test/example/scopes/scopes.html index 6c3307394..d93440a94 100644 --- a/fixtures/_test/example/scopes/scopes.html +++ b/fixtures/_test/example/scopes/scopes.html @@ -1,7 +1,7 @@ - + diff --git a/fixtures/_testSound/example/scopes/scopes_main.dart b/fixtures/_testSound/example/scopes/main.dart similarity index 100% rename from fixtures/_testSound/example/scopes/scopes_main.dart rename to fixtures/_testSound/example/scopes/main.dart diff --git a/fixtures/_testSound/example/scopes/scopes.html b/fixtures/_testSound/example/scopes/scopes.html index 6c3307394..d93440a94 100644 --- a/fixtures/_testSound/example/scopes/scopes.html +++ b/fixtures/_testSound/example/scopes/scopes.html @@ -1,7 +1,7 @@ - + From 197f7b973f5d46906d072c146683e715ecfebfd7 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 22 Dec 2022 12:37:08 -0800 Subject: [PATCH 24/26] Another attempt at fixing failing tests --- dwds/test/fixtures/context.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 8cf730e3f..505d1c8df 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -70,10 +70,12 @@ class TestContext { /// The path to the HTML file to serve, relative to the [directoryToServe], /// e.g. "hello_world/index.html". - String get filePathToServe => p.relative( - p.join(webAssetsPath, htmlEntryFileName), - from: directoryToServe, - ); + String get filePathToServe { + final pathParts = p.split(webAssetsPath).where( + (pathPart) => pathPart != directoryToServe, + ); + return p.joinAll([...pathParts, htmlEntryFileName]); + } /// The entry file is the Dart entry file, e.g, /// "/workstation/webdev/fixtures/_testSound/example/hello_world/main.dart": From f3ced079f01338fdbf13c3a53265cac3af3ed7c9 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 22 Dec 2022 15:56:39 -0800 Subject: [PATCH 25/26] Update filePathToServe method --- dwds/test/fixtures/context.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 505d1c8df..31ed44276 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -74,7 +74,10 @@ class TestContext { final pathParts = p.split(webAssetsPath).where( (pathPart) => pathPart != directoryToServe, ); - return p.joinAll([...pathParts, htmlEntryFileName]); + // Note: Replacing "\" with "/" is necessary because `joinAll` uses "\" if + // the platform is Windows. However, this path is used by the browser, not + // by the OS. + return p.joinAll([...pathParts, htmlEntryFileName]).replaceAll('\\', '/'); } /// The entry file is the Dart entry file, e.g, From ed471690f90af1efc87b47d64b5af857bedcf132 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 4 Jan 2023 17:39:42 -0800 Subject: [PATCH 26/26] Respond to PR comments --- dwds/test/fixtures/context.dart | 7 ++----- dwds/test/fixtures/utilities.dart | 7 +++++++ dwds/test/inspector_test.dart | 3 ++- dwds/test/instance_test.dart | 3 ++- dwds/test/reload_test.dart | 3 ++- dwds/test/variable_scope_test.dart | 3 ++- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 31ed44276..ff62190ad 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -74,10 +74,7 @@ class TestContext { final pathParts = p.split(webAssetsPath).where( (pathPart) => pathPart != directoryToServe, ); - // Note: Replacing "\" with "/" is necessary because `joinAll` uses "\" if - // the platform is Windows. However, this path is used by the browser, not - // by the OS. - return p.joinAll([...pathParts, htmlEntryFileName]).replaceAll('\\', '/'); + return webCompatiblePath([...pathParts, htmlEntryFileName]); } /// The entry file is the Dart entry file, e.g, @@ -96,7 +93,7 @@ class TestContext { /// The URI for the package_config.json is located in: /// /.dart_tool/package_config Uri get _packageConfigFile => - p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json')); + p.toUri(p.join(workingDirectory, '.dart_tool', 'package_config.json')); String get appUrl => _appUrl!; late String? _appUrl; diff --git a/dwds/test/fixtures/utilities.dart b/dwds/test/fixtures/utilities.dart index 68a8b8aac..dacb24412 100644 --- a/dwds/test/fixtures/utilities.dart +++ b/dwds/test/fixtures/utilities.dart @@ -36,6 +36,13 @@ String get fixturesPath { return p.join(webdevPath, fixturesDirName); } +// Creates a path compatible for web. +String webCompatiblePath(List pathParts) { + // Note: Replacing "\" with "/" is necessary because `joinAll` uses "\" if + // the platform is Windows. However, only "/" is expected by the browser. + return p.joinAll([...pathParts]).replaceAll('\\', '/'); +} + /// Expects one of [pathFromWebdev], [pathFromDwds] or [pathFromFixtures] to be /// provided. Returns the absolute path in the local machine to that path, e.g. /// absolutePath(pathFromFixtures: '_test/example') -> diff --git a/dwds/test/inspector_test.dart b/dwds/test/inspector_test.dart index 5dd715f61..10100f93b 100644 --- a/dwds/test/inspector_test.dart +++ b/dwds/test/inspector_test.dart @@ -16,9 +16,10 @@ import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; +import 'fixtures/utilities.dart'; final context = TestContext.withSoundNullSafety( - webAssetsPath: 'example/scopes', + webAssetsPath: webCompatiblePath(['example', 'scopes']), dartEntryFileName: 'main.dart', htmlEntryFileName: 'scopes.html', ); diff --git a/dwds/test/instance_test.dart b/dwds/test/instance_test.dart index 242fa2882..c5f279703 100644 --- a/dwds/test/instance_test.dart +++ b/dwds/test/instance_test.dart @@ -14,9 +14,10 @@ import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; +import 'fixtures/utilities.dart'; final context = TestContext.withSoundNullSafety( - webAssetsPath: 'example/scopes', + webAssetsPath: webCompatiblePath(['example', 'scopes']), dartEntryFileName: 'main.dart', htmlEntryFileName: 'scopes.html', ); diff --git a/dwds/test/reload_test.dart b/dwds/test/reload_test.dart index 54be98a71..9c0815fa1 100644 --- a/dwds/test/reload_test.dart +++ b/dwds/test/reload_test.dart @@ -11,9 +11,10 @@ import 'package:vm_service/vm_service.dart'; import 'fixtures/context.dart'; import 'fixtures/logging.dart'; +import 'fixtures/utilities.dart'; final context = TestContext.withSoundNullSafety( - webAssetsPath: 'example/append_body', + webAssetsPath: webCompatiblePath(['example', 'append_body']), dartEntryFileName: 'main.dart', htmlEntryFileName: 'index.html', ); diff --git a/dwds/test/variable_scope_test.dart b/dwds/test/variable_scope_test.dart index 3ae0dc99b..19a7c7eb6 100644 --- a/dwds/test/variable_scope_test.dart +++ b/dwds/test/variable_scope_test.dart @@ -12,9 +12,10 @@ import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; +import 'fixtures/utilities.dart'; final context = TestContext.withSoundNullSafety( - webAssetsPath: 'example/scopes', + webAssetsPath: webCompatiblePath(['example', 'scopes']), dartEntryFileName: 'main.dart', htmlEntryFileName: 'scopes.html', );