Prepare for Dart 3.0 api removals (#1812)
Fixes #1811
I also pre-emptively bumped our dep on matcher, which I think should be fine, but please push back if you disagree.
Moves all null safety related tests into a legacy_tests directory.
diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml
index 610dc0d..127f819 100644
--- a/.github/workflows/dart.yml
+++ b/.github/workflows/dart.yml
@@ -40,6 +40,40 @@
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
+ name: "analyze_and_format; linux; Dart 2.18.0; PKG: legacy_tests/nnbd_opted_in_with_optout; `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
+ with:
+ path: "~/.pub-cache/hosted"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0;packages:legacy_tests/nnbd_opted_in_with_optout;commands:format-analyze_0"
+ restore-keys: |
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0;packages:legacy_tests/nnbd_opted_in_with_optout
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0
+ os:ubuntu-latest;pub-cache-hosted
+ os:ubuntu-latest
+ - name: Setup Dart SDK
+ uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
+ with:
+ sdk: "2.18.0"
+ - id: checkout
+ name: Checkout repository
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - id: legacy_tests_nnbd_opted_in_with_optout_pub_upgrade
+ name: legacy_tests/nnbd_opted_in_with_optout; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in_with_optout
+ - name: "legacy_tests/nnbd_opted_in_with_optout; dart format --output=none --set-exit-if-changed ."
+ run: "dart format --output=none --set-exit-if-changed ."
+ if: "always() && steps.legacy_tests_nnbd_opted_in_with_optout_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in_with_optout
+ - name: "legacy_tests/nnbd_opted_in_with_optout; dart analyze --fatal-infos"
+ run: dart analyze --fatal-infos
+ if: "always() && steps.legacy_tests_nnbd_opted_in_with_optout_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in_with_optout
+ job_003:
name: "analyze_and_format; linux; Dart 2.18.0; PKGS: pkgs/checks, pkgs/test_core; `dart analyze`"
runs-on: ubuntu-latest
steps:
@@ -78,17 +112,17 @@
run: dart analyze
if: "always() && steps.pkgs_test_core_pub_upgrade.conclusion == 'success'"
working-directory: pkgs/test_core
- job_003:
- name: "analyze_and_format; linux; Dart dev; PKGS: integration_tests/nnbd_opted_in, integration_tests/nnbd_opted_out, integration_tests/spawn_hybrid, pkgs/checks, pkgs/test, pkgs/test_api, pkgs/test_core; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos`"
+ job_004:
+ name: "analyze_and_format; linux; Dart dev; PKGS: integration_tests/spawn_hybrid, legacy_tests/nnbd_opted_in, pkgs/checks, pkgs/test, pkgs/test_api, pkgs/test_core; `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
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/nnbd_opted_in-integration_tests/nnbd_opted_out-integration_tests/spawn_hybrid-pkgs/checks-pkgs/test-pkgs/test_api-pkgs/test_core;commands:format-analyze_0"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/spawn_hybrid-legacy_tests/nnbd_opted_in-pkgs/checks-pkgs/test-pkgs/test_api-pkgs/test_core;commands:format-analyze_0"
restore-keys: |
- os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/nnbd_opted_in-integration_tests/nnbd_opted_out-integration_tests/spawn_hybrid-pkgs/checks-pkgs/test-pkgs/test_api-pkgs/test_core
+ os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/spawn_hybrid-legacy_tests/nnbd_opted_in-pkgs/checks-pkgs/test-pkgs/test_api-pkgs/test_core
os:ubuntu-latest;pub-cache-hosted;sdk:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
@@ -99,32 +133,6 @@
- id: checkout
name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- - id: integration_tests_nnbd_opted_in_pub_upgrade
- name: integration_tests/nnbd_opted_in; dart pub upgrade
- run: dart pub upgrade
- if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- - name: "integration_tests/nnbd_opted_in; dart format --output=none --set-exit-if-changed ."
- run: "dart format --output=none --set-exit-if-changed ."
- if: "always() && steps.integration_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- - name: "integration_tests/nnbd_opted_in; dart analyze --fatal-infos"
- run: dart analyze --fatal-infos
- if: "always() && steps.integration_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- - id: integration_tests_nnbd_opted_out_pub_upgrade
- name: integration_tests/nnbd_opted_out; dart pub upgrade
- run: dart pub upgrade
- if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- - name: "integration_tests/nnbd_opted_out; dart format --output=none --set-exit-if-changed ."
- run: "dart format --output=none --set-exit-if-changed ."
- if: "always() && steps.integration_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- - name: "integration_tests/nnbd_opted_out; dart analyze --fatal-infos"
- run: dart analyze --fatal-infos
- if: "always() && steps.integration_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- id: integration_tests_spawn_hybrid_pub_upgrade
name: integration_tests/spawn_hybrid; dart pub upgrade
run: dart pub upgrade
@@ -138,6 +146,19 @@
run: dart analyze --fatal-infos
if: "always() && steps.integration_tests_spawn_hybrid_pub_upgrade.conclusion == 'success'"
working-directory: integration_tests/spawn_hybrid
+ - id: legacy_tests_nnbd_opted_in_pub_upgrade
+ name: legacy_tests/nnbd_opted_in; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in
+ - name: "legacy_tests/nnbd_opted_in; dart format --output=none --set-exit-if-changed ."
+ run: "dart format --output=none --set-exit-if-changed ."
+ if: "always() && steps.legacy_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in
+ - name: "legacy_tests/nnbd_opted_in; dart analyze --fatal-infos"
+ run: dart analyze --fatal-infos
+ if: "always() && steps.legacy_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in
- id: pkgs_checks_pub_upgrade
name: pkgs/checks; dart pub upgrade
run: dart pub upgrade
@@ -190,7 +211,7 @@
run: dart analyze --fatal-infos
if: "always() && steps.pkgs_test_core_pub_upgrade.conclusion == 'success'"
working-directory: pkgs/test_core
- job_004:
+ job_005:
name: "analyze_and_format; linux; Dart main; PKG: integration_tests/wasm; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos`"
runs-on: ubuntu-latest
steps:
@@ -224,76 +245,53 @@
run: dart analyze --fatal-infos
if: "always() && steps.integration_tests_wasm_pub_upgrade.conclusion == 'success'"
working-directory: integration_tests/wasm
- job_005:
- name: "unit_test; linux; Dart 2.18.0; PKG: integration_tests/nnbd_opted_in; `dart test -p chrome,vm,node`"
- 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:2.18.0;packages:integration_tests/nnbd_opted_in;commands:test"
- restore-keys: |
- os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0;packages:integration_tests/nnbd_opted_in
- os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0
- os:ubuntu-latest;pub-cache-hosted
- os:ubuntu-latest
- - name: Setup Dart SDK
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
- with:
- sdk: "2.18.0"
- - id: checkout
- name: Checkout repository
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- - id: integration_tests_nnbd_opted_in_pub_upgrade
- name: integration_tests/nnbd_opted_in; dart pub upgrade
- run: dart pub upgrade
- if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- - name: "integration_tests/nnbd_opted_in; dart test -p chrome,vm,node"
- run: "dart test -p chrome,vm,node"
- if: "always() && steps.integration_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- needs:
- - job_001
- - job_002
- - job_003
- - job_004
job_006:
- name: "unit_test; linux; Dart 2.18.0; PKG: integration_tests/nnbd_opted_out; `dart test -p chrome,vm,node`"
+ name: "analyze_and_format; linux; Dart stable; PKGS: legacy_tests/nnbd_opted_out, legacy_tests/spawn_hybrid_with_optout; `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
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0;packages:integration_tests/nnbd_opted_out;commands:test"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:legacy_tests/nnbd_opted_out-legacy_tests/spawn_hybrid_with_optout;commands:format-analyze_0"
restore-keys: |
- os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0;packages:integration_tests/nnbd_opted_out
- os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0
+ os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:legacy_tests/nnbd_opted_out-legacy_tests/spawn_hybrid_with_optout
+ 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
with:
- sdk: "2.18.0"
+ sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- - id: integration_tests_nnbd_opted_out_pub_upgrade
- name: integration_tests/nnbd_opted_out; dart pub upgrade
+ - id: legacy_tests_nnbd_opted_out_pub_upgrade
+ name: legacy_tests/nnbd_opted_out; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- - name: "integration_tests/nnbd_opted_out; dart test -p chrome,vm,node"
- run: "dart test -p chrome,vm,node"
- if: "always() && steps.integration_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- needs:
- - job_001
- - job_002
- - job_003
- - job_004
+ working-directory: legacy_tests/nnbd_opted_out
+ - name: "legacy_tests/nnbd_opted_out; dart format --output=none --set-exit-if-changed ."
+ run: "dart format --output=none --set-exit-if-changed ."
+ if: "always() && steps.legacy_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_out
+ - name: "legacy_tests/nnbd_opted_out; dart analyze --fatal-infos"
+ run: dart analyze --fatal-infos
+ if: "always() && steps.legacy_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_out
+ - id: legacy_tests_spawn_hybrid_with_optout_pub_upgrade
+ name: legacy_tests/spawn_hybrid_with_optout; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/spawn_hybrid_with_optout
+ - name: "legacy_tests/spawn_hybrid_with_optout; dart format --output=none --set-exit-if-changed ."
+ run: "dart format --output=none --set-exit-if-changed ."
+ if: "always() && steps.legacy_tests_spawn_hybrid_with_optout_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/spawn_hybrid_with_optout
+ - name: "legacy_tests/spawn_hybrid_with_optout; dart analyze --fatal-infos"
+ run: dart analyze --fatal-infos
+ if: "always() && steps.legacy_tests_spawn_hybrid_with_optout_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/spawn_hybrid_with_optout
job_007:
name: "unit_test; linux; Dart 2.18.0; PKG: integration_tests/spawn_hybrid; `dart test -p chrome,vm,node`"
runs-on: ubuntu-latest
@@ -329,7 +327,157 @@
- job_002
- job_003
- job_004
+ - job_005
+ - job_006
job_008:
+ name: "unit_test; linux; Dart 2.18.0; PKG: legacy_tests/nnbd_opted_in; `dart test -p chrome,vm,node`"
+ 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:2.18.0;packages:legacy_tests/nnbd_opted_in;commands:test"
+ restore-keys: |
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0;packages:legacy_tests/nnbd_opted_in
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0
+ os:ubuntu-latest;pub-cache-hosted
+ os:ubuntu-latest
+ - name: Setup Dart SDK
+ uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
+ with:
+ sdk: "2.18.0"
+ - id: checkout
+ name: Checkout repository
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - id: legacy_tests_nnbd_opted_in_pub_upgrade
+ name: legacy_tests/nnbd_opted_in; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in
+ - name: "legacy_tests/nnbd_opted_in; dart test -p chrome,vm,node"
+ run: "dart test -p chrome,vm,node"
+ if: "always() && steps.legacy_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in
+ needs:
+ - job_001
+ - job_002
+ - job_003
+ - job_004
+ - job_005
+ - job_006
+ job_009:
+ name: "unit_test; linux; Dart 2.18.0; PKG: legacy_tests/nnbd_opted_in_with_optout; `dart test -p chrome,vm,node`"
+ 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:2.18.0;packages:legacy_tests/nnbd_opted_in_with_optout;commands:test"
+ restore-keys: |
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0;packages:legacy_tests/nnbd_opted_in_with_optout
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0
+ os:ubuntu-latest;pub-cache-hosted
+ os:ubuntu-latest
+ - name: Setup Dart SDK
+ uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
+ with:
+ sdk: "2.18.0"
+ - id: checkout
+ name: Checkout repository
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - id: legacy_tests_nnbd_opted_in_with_optout_pub_upgrade
+ name: legacy_tests/nnbd_opted_in_with_optout; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in_with_optout
+ - name: "legacy_tests/nnbd_opted_in_with_optout; dart test -p chrome,vm,node"
+ run: "dart test -p chrome,vm,node"
+ if: "always() && steps.legacy_tests_nnbd_opted_in_with_optout_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in_with_optout
+ needs:
+ - job_001
+ - job_002
+ - job_003
+ - job_004
+ - job_005
+ - job_006
+ job_010:
+ name: "unit_test; linux; Dart 2.18.0; PKG: legacy_tests/nnbd_opted_out; `dart test -p chrome,vm,node`"
+ 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:2.18.0;packages:legacy_tests/nnbd_opted_out;commands:test"
+ restore-keys: |
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0;packages:legacy_tests/nnbd_opted_out
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0
+ os:ubuntu-latest;pub-cache-hosted
+ os:ubuntu-latest
+ - name: Setup Dart SDK
+ uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
+ with:
+ sdk: "2.18.0"
+ - id: checkout
+ name: Checkout repository
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - id: legacy_tests_nnbd_opted_out_pub_upgrade
+ name: legacy_tests/nnbd_opted_out; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_out
+ - name: "legacy_tests/nnbd_opted_out; dart test -p chrome,vm,node"
+ run: "dart test -p chrome,vm,node"
+ if: "always() && steps.legacy_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_out
+ needs:
+ - job_001
+ - job_002
+ - job_003
+ - job_004
+ - job_005
+ - job_006
+ job_011:
+ name: "unit_test; linux; Dart 2.18.0; PKG: legacy_tests/spawn_hybrid_with_optout; `dart test -p chrome,vm,node`"
+ 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:2.18.0;packages:legacy_tests/spawn_hybrid_with_optout;commands:test"
+ restore-keys: |
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0;packages:legacy_tests/spawn_hybrid_with_optout
+ os:ubuntu-latest;pub-cache-hosted;sdk:2.18.0
+ os:ubuntu-latest;pub-cache-hosted
+ os:ubuntu-latest
+ - name: Setup Dart SDK
+ uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
+ with:
+ sdk: "2.18.0"
+ - id: checkout
+ name: Checkout repository
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - id: legacy_tests_spawn_hybrid_with_optout_pub_upgrade
+ name: legacy_tests/spawn_hybrid_with_optout; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/spawn_hybrid_with_optout
+ - name: "legacy_tests/spawn_hybrid_with_optout; dart test -p chrome,vm,node"
+ run: "dart test -p chrome,vm,node"
+ if: "always() && steps.legacy_tests_spawn_hybrid_with_optout_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/spawn_hybrid_with_optout
+ needs:
+ - job_001
+ - job_002
+ - job_003
+ - job_004
+ - job_005
+ - job_006
+ job_012:
name: "unit_test; linux; Dart 2.18.0; PKG: pkgs/checks; `dart test`"
runs-on: ubuntu-latest
steps:
@@ -364,7 +512,9 @@
- job_002
- job_003
- job_004
- job_009:
+ - job_005
+ - job_006
+ job_013:
name: "unit_test; linux; Dart 2.18.0; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 0`"
runs-on: ubuntu-latest
steps:
@@ -399,7 +549,9 @@
- job_002
- job_003
- job_004
- job_010:
+ - job_005
+ - job_006
+ job_014:
name: "unit_test; linux; Dart 2.18.0; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 1`"
runs-on: ubuntu-latest
steps:
@@ -434,7 +586,9 @@
- job_002
- job_003
- job_004
- job_011:
+ - job_005
+ - job_006
+ job_015:
name: "unit_test; linux; Dart 2.18.0; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 2`"
runs-on: ubuntu-latest
steps:
@@ -469,7 +623,9 @@
- job_002
- job_003
- job_004
- job_012:
+ - job_005
+ - job_006
+ job_016:
name: "unit_test; linux; Dart 2.18.0; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 3`"
runs-on: ubuntu-latest
steps:
@@ -504,7 +660,9 @@
- job_002
- job_003
- job_004
- job_013:
+ - job_005
+ - job_006
+ job_017:
name: "unit_test; linux; Dart 2.18.0; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 4`"
runs-on: ubuntu-latest
steps:
@@ -539,7 +697,9 @@
- job_002
- job_003
- job_004
- job_014:
+ - job_005
+ - job_006
+ job_018:
name: "unit_test; linux; Dart 2.18.0; PKG: pkgs/test_api; `dart test --preset travis -x browser`"
runs-on: ubuntu-latest
steps:
@@ -574,77 +734,9 @@
- job_002
- job_003
- job_004
- job_015:
- name: "unit_test; linux; Dart dev; PKG: integration_tests/nnbd_opted_in; `dart test -p chrome,vm,node`"
- 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:integration_tests/nnbd_opted_in;commands:test"
- restore-keys: |
- os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/nnbd_opted_in
- 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
- with:
- sdk: dev
- - id: checkout
- name: Checkout repository
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- - id: integration_tests_nnbd_opted_in_pub_upgrade
- name: integration_tests/nnbd_opted_in; dart pub upgrade
- run: dart pub upgrade
- if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- - name: "integration_tests/nnbd_opted_in; dart test -p chrome,vm,node"
- run: "dart test -p chrome,vm,node"
- if: "always() && steps.integration_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- needs:
- - job_001
- - job_002
- - job_003
- - job_004
- job_016:
- name: "unit_test; linux; Dart dev; PKG: integration_tests/nnbd_opted_out; `dart test -p chrome,vm,node`"
- 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:integration_tests/nnbd_opted_out;commands:test"
- restore-keys: |
- os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/nnbd_opted_out
- 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
- with:
- sdk: dev
- - id: checkout
- name: Checkout repository
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- - id: integration_tests_nnbd_opted_out_pub_upgrade
- name: integration_tests/nnbd_opted_out; dart pub upgrade
- run: dart pub upgrade
- if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- - name: "integration_tests/nnbd_opted_out; dart test -p chrome,vm,node"
- run: "dart test -p chrome,vm,node"
- if: "always() && steps.integration_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- needs:
- - job_001
- - job_002
- - job_003
- - job_004
- job_017:
+ - job_005
+ - job_006
+ job_019:
name: "unit_test; linux; Dart dev; PKG: integration_tests/spawn_hybrid; `dart test -p chrome,vm,node`"
runs-on: ubuntu-latest
steps:
@@ -679,7 +771,9 @@
- job_002
- job_003
- job_004
- job_018:
+ - job_005
+ - job_006
+ job_020:
name: "unit_test; linux; Dart dev; PKG: pkgs/checks; `dart test`"
runs-on: ubuntu-latest
steps:
@@ -714,7 +808,9 @@
- job_002
- job_003
- job_004
- job_019:
+ - job_005
+ - job_006
+ job_021:
name: "unit_test; linux; Dart dev; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 0`"
runs-on: ubuntu-latest
steps:
@@ -749,7 +845,9 @@
- job_002
- job_003
- job_004
- job_020:
+ - job_005
+ - job_006
+ job_022:
name: "unit_test; linux; Dart dev; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 1`"
runs-on: ubuntu-latest
steps:
@@ -784,7 +882,9 @@
- job_002
- job_003
- job_004
- job_021:
+ - job_005
+ - job_006
+ job_023:
name: "unit_test; linux; Dart dev; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 2`"
runs-on: ubuntu-latest
steps:
@@ -819,7 +919,9 @@
- job_002
- job_003
- job_004
- job_022:
+ - job_005
+ - job_006
+ job_024:
name: "unit_test; linux; Dart dev; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 3`"
runs-on: ubuntu-latest
steps:
@@ -854,7 +956,9 @@
- job_002
- job_003
- job_004
- job_023:
+ - job_005
+ - job_006
+ job_025:
name: "unit_test; linux; Dart dev; PKG: pkgs/test; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --preset travis --total-shards 5 --shard-index 4`"
runs-on: ubuntu-latest
steps:
@@ -889,7 +993,9 @@
- job_002
- job_003
- job_004
- job_024:
+ - job_005
+ - job_006
+ job_026:
name: "unit_test; linux; Dart dev; PKG: pkgs/test_api; `dart test --preset travis -x browser`"
runs-on: ubuntu-latest
steps:
@@ -924,56 +1030,8 @@
- job_002
- job_003
- job_004
- job_025:
- name: "unit_test; windows; Dart 2.18.0; PKG: integration_tests/nnbd_opted_in; `dart test -p chrome,vm,node`"
- runs-on: windows-latest
- steps:
- - name: Setup Dart SDK
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
- with:
- sdk: "2.18.0"
- - id: checkout
- name: Checkout repository
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- - id: integration_tests_nnbd_opted_in_pub_upgrade
- name: integration_tests/nnbd_opted_in; dart pub upgrade
- run: dart pub upgrade
- if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- - name: "integration_tests/nnbd_opted_in; dart test -p chrome,vm,node"
- run: "dart test -p chrome,vm,node"
- if: "always() && steps.integration_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- needs:
- - job_001
- - job_002
- - job_003
- - job_004
- job_026:
- name: "unit_test; windows; Dart 2.18.0; PKG: integration_tests/nnbd_opted_out; `dart test -p chrome,vm,node`"
- runs-on: windows-latest
- steps:
- - name: Setup Dart SDK
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
- with:
- sdk: "2.18.0"
- - id: checkout
- name: Checkout repository
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- - id: integration_tests_nnbd_opted_out_pub_upgrade
- name: integration_tests/nnbd_opted_out; dart pub upgrade
- run: dart pub upgrade
- if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- - name: "integration_tests/nnbd_opted_out; dart test -p chrome,vm,node"
- run: "dart test -p chrome,vm,node"
- if: "always() && steps.integration_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- needs:
- - job_001
- - job_002
- - job_003
- - job_004
+ - job_005
+ - job_006
job_027:
name: "unit_test; windows; Dart 2.18.0; PKG: integration_tests/spawn_hybrid; `dart test -p chrome,vm,node`"
runs-on: windows-latest
@@ -999,7 +1057,117 @@
- job_002
- job_003
- job_004
+ - job_005
+ - job_006
job_028:
+ name: "unit_test; windows; Dart 2.18.0; PKG: legacy_tests/nnbd_opted_in; `dart test -p chrome,vm,node`"
+ runs-on: windows-latest
+ steps:
+ - name: Setup Dart SDK
+ uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
+ with:
+ sdk: "2.18.0"
+ - id: checkout
+ name: Checkout repository
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - id: legacy_tests_nnbd_opted_in_pub_upgrade
+ name: legacy_tests/nnbd_opted_in; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in
+ - name: "legacy_tests/nnbd_opted_in; dart test -p chrome,vm,node"
+ run: "dart test -p chrome,vm,node"
+ if: "always() && steps.legacy_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in
+ needs:
+ - job_001
+ - job_002
+ - job_003
+ - job_004
+ - job_005
+ - job_006
+ job_029:
+ name: "unit_test; windows; Dart 2.18.0; PKG: legacy_tests/nnbd_opted_in_with_optout; `dart test -p chrome,vm,node`"
+ runs-on: windows-latest
+ steps:
+ - name: Setup Dart SDK
+ uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
+ with:
+ sdk: "2.18.0"
+ - id: checkout
+ name: Checkout repository
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - id: legacy_tests_nnbd_opted_in_with_optout_pub_upgrade
+ name: legacy_tests/nnbd_opted_in_with_optout; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in_with_optout
+ - name: "legacy_tests/nnbd_opted_in_with_optout; dart test -p chrome,vm,node"
+ run: "dart test -p chrome,vm,node"
+ if: "always() && steps.legacy_tests_nnbd_opted_in_with_optout_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_in_with_optout
+ needs:
+ - job_001
+ - job_002
+ - job_003
+ - job_004
+ - job_005
+ - job_006
+ job_030:
+ name: "unit_test; windows; Dart 2.18.0; PKG: legacy_tests/nnbd_opted_out; `dart test -p chrome,vm,node`"
+ runs-on: windows-latest
+ steps:
+ - name: Setup Dart SDK
+ uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
+ with:
+ sdk: "2.18.0"
+ - id: checkout
+ name: Checkout repository
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - id: legacy_tests_nnbd_opted_out_pub_upgrade
+ name: legacy_tests/nnbd_opted_out; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_out
+ - name: "legacy_tests/nnbd_opted_out; dart test -p chrome,vm,node"
+ run: "dart test -p chrome,vm,node"
+ if: "always() && steps.legacy_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/nnbd_opted_out
+ needs:
+ - job_001
+ - job_002
+ - job_003
+ - job_004
+ - job_005
+ - job_006
+ job_031:
+ name: "unit_test; windows; Dart 2.18.0; PKG: legacy_tests/spawn_hybrid_with_optout; `dart test -p chrome,vm,node`"
+ runs-on: windows-latest
+ steps:
+ - name: Setup Dart SDK
+ uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
+ with:
+ sdk: "2.18.0"
+ - id: checkout
+ name: Checkout repository
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - id: legacy_tests_spawn_hybrid_with_optout_pub_upgrade
+ name: legacy_tests/spawn_hybrid_with_optout; dart pub upgrade
+ run: dart pub upgrade
+ if: "always() && steps.checkout.conclusion == 'success'"
+ working-directory: legacy_tests/spawn_hybrid_with_optout
+ - name: "legacy_tests/spawn_hybrid_with_optout; dart test -p chrome,vm,node"
+ run: "dart test -p chrome,vm,node"
+ if: "always() && steps.legacy_tests_spawn_hybrid_with_optout_pub_upgrade.conclusion == 'success'"
+ working-directory: legacy_tests/spawn_hybrid_with_optout
+ needs:
+ - job_001
+ - job_002
+ - job_003
+ - job_004
+ - job_005
+ - job_006
+ job_032:
name: "unit_test; windows; Dart 2.18.0; PKG: pkgs/test; `dart test --preset travis --total-shards 5 --shard-index 0`"
runs-on: windows-latest
steps:
@@ -1024,7 +1192,9 @@
- job_002
- job_003
- job_004
- job_029:
+ - job_005
+ - job_006
+ job_033:
name: "unit_test; windows; Dart 2.18.0; PKG: pkgs/test; `dart test --preset travis --total-shards 5 --shard-index 1`"
runs-on: windows-latest
steps:
@@ -1049,7 +1219,9 @@
- job_002
- job_003
- job_004
- job_030:
+ - job_005
+ - job_006
+ job_034:
name: "unit_test; windows; Dart 2.18.0; PKG: pkgs/test; `dart test --preset travis --total-shards 5 --shard-index 2`"
runs-on: windows-latest
steps:
@@ -1074,7 +1246,9 @@
- job_002
- job_003
- job_004
- job_031:
+ - job_005
+ - job_006
+ job_035:
name: "unit_test; windows; Dart 2.18.0; PKG: pkgs/test; `dart test --preset travis --total-shards 5 --shard-index 3`"
runs-on: windows-latest
steps:
@@ -1099,7 +1273,9 @@
- job_002
- job_003
- job_004
- job_032:
+ - job_005
+ - job_006
+ job_036:
name: "unit_test; windows; Dart 2.18.0; PKG: pkgs/test; `dart test --preset travis --total-shards 5 --shard-index 4`"
runs-on: windows-latest
steps:
@@ -1124,57 +1300,9 @@
- job_002
- job_003
- job_004
- job_033:
- name: "unit_test; windows; Dart dev; PKG: integration_tests/nnbd_opted_in; `dart test -p chrome,vm,node`"
- runs-on: windows-latest
- steps:
- - name: Setup Dart SDK
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
- with:
- sdk: dev
- - id: checkout
- name: Checkout repository
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- - id: integration_tests_nnbd_opted_in_pub_upgrade
- name: integration_tests/nnbd_opted_in; dart pub upgrade
- run: dart pub upgrade
- if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- - name: "integration_tests/nnbd_opted_in; dart test -p chrome,vm,node"
- run: "dart test -p chrome,vm,node"
- if: "always() && steps.integration_tests_nnbd_opted_in_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_in
- needs:
- - job_001
- - job_002
- - job_003
- - job_004
- job_034:
- name: "unit_test; windows; Dart dev; PKG: integration_tests/nnbd_opted_out; `dart test -p chrome,vm,node`"
- runs-on: windows-latest
- steps:
- - name: Setup Dart SDK
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
- with:
- sdk: dev
- - id: checkout
- name: Checkout repository
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- - id: integration_tests_nnbd_opted_out_pub_upgrade
- name: integration_tests/nnbd_opted_out; dart pub upgrade
- run: dart pub upgrade
- if: "always() && steps.checkout.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- - name: "integration_tests/nnbd_opted_out; dart test -p chrome,vm,node"
- run: "dart test -p chrome,vm,node"
- if: "always() && steps.integration_tests_nnbd_opted_out_pub_upgrade.conclusion == 'success'"
- working-directory: integration_tests/nnbd_opted_out
- needs:
- - job_001
- - job_002
- - job_003
- - job_004
- job_035:
+ - job_005
+ - job_006
+ job_037:
name: "unit_test; windows; Dart dev; PKG: integration_tests/spawn_hybrid; `dart test -p chrome,vm,node`"
runs-on: windows-latest
steps:
@@ -1199,7 +1327,9 @@
- job_002
- job_003
- job_004
- job_036:
+ - job_005
+ - job_006
+ job_038:
name: Notify failure
runs-on: ubuntu-latest
if: "(github.event_name == 'push' || github.event_name == 'schedule') && failure()"
@@ -1246,3 +1376,5 @@
- job_033
- job_034
- job_035
+ - job_036
+ - job_037
diff --git a/integration_tests/spawn_hybrid/test/hybrid_test.dart b/integration_tests/spawn_hybrid/test/hybrid_test.dart
index 6b6de3c..75f7250 100644
--- a/integration_tests/spawn_hybrid/test/hybrid_test.dart
+++ b/integration_tests/spawn_hybrid/test/hybrid_test.dart
@@ -341,20 +341,6 @@
});
});
- test('can opt out of null safety', () async {
- expect(spawnHybridCode('''
- // @dart=2.9
- import "package:stream_channel/stream_channel.dart";
-
- // Would cause an error in null safety mode.
- int x;
-
- void hybridMain(StreamChannel channel) {
- channel.sink..add(1)..add(2)..add(3)..close();
- }
- ''').stream.toList(), completion(equals([1, 2, 3])));
- });
-
test('opts in to null safety by default', () async {
expect(spawnHybridCode('''
import "package:stream_channel/stream_channel.dart";
diff --git a/integration_tests/nnbd_opted_in/mono_pkg.yaml b/legacy_tests/nnbd_opted_in/mono_pkg.yaml
similarity index 97%
rename from integration_tests/nnbd_opted_in/mono_pkg.yaml
rename to legacy_tests/nnbd_opted_in/mono_pkg.yaml
index 7d75b61..682f76e 100644
--- a/integration_tests/nnbd_opted_in/mono_pkg.yaml
+++ b/legacy_tests/nnbd_opted_in/mono_pkg.yaml
@@ -1,7 +1,6 @@
# See https://pub.dev/packages/mono_repo
sdk:
-- dev
- pubspec
stages:
diff --git a/integration_tests/nnbd_opted_in/pubspec.yaml b/legacy_tests/nnbd_opted_in/pubspec.yaml
similarity index 100%
rename from integration_tests/nnbd_opted_in/pubspec.yaml
rename to legacy_tests/nnbd_opted_in/pubspec.yaml
diff --git a/integration_tests/nnbd_opted_in/test/common/is_opted_out.dart b/legacy_tests/nnbd_opted_in/test/common/is_opted_out.dart
similarity index 100%
rename from integration_tests/nnbd_opted_in/test/common/is_opted_out.dart
rename to legacy_tests/nnbd_opted_in/test/common/is_opted_out.dart
diff --git a/integration_tests/nnbd_opted_in/test/opted_in_test.dart b/legacy_tests/nnbd_opted_in/test/opted_in_test.dart
similarity index 100%
rename from integration_tests/nnbd_opted_in/test/opted_in_test.dart
rename to legacy_tests/nnbd_opted_in/test/opted_in_test.dart
diff --git a/integration_tests/nnbd_opted_in/mono_pkg.yaml b/legacy_tests/nnbd_opted_in_with_optout/mono_pkg.yaml
similarity index 92%
copy from integration_tests/nnbd_opted_in/mono_pkg.yaml
copy to legacy_tests/nnbd_opted_in_with_optout/mono_pkg.yaml
index 7d75b61..5b5ac14 100644
--- a/integration_tests/nnbd_opted_in/mono_pkg.yaml
+++ b/legacy_tests/nnbd_opted_in_with_optout/mono_pkg.yaml
@@ -1,7 +1,6 @@
# See https://pub.dev/packages/mono_repo
sdk:
-- dev
- pubspec
stages:
@@ -10,7 +9,7 @@
- format
- analyze: --fatal-infos
sdk:
- - dev
+ - pubspec
- unit_test:
- test: -p chrome,vm,node
os:
diff --git a/legacy_tests/nnbd_opted_in_with_optout/pubspec.yaml b/legacy_tests/nnbd_opted_in_with_optout/pubspec.yaml
new file mode 100644
index 0000000..11517a6
--- /dev/null
+++ b/legacy_tests/nnbd_opted_in_with_optout/pubspec.yaml
@@ -0,0 +1,13 @@
+name: nnbd_opted_in_with_optout
+environment:
+ sdk: '>=2.18.0 <3.0.0'
+dev_dependencies:
+ lints: '>=1.0.0 <3.0.0'
+ test: any
+dependency_overrides:
+ test:
+ path: ../../pkgs/test
+ test_api:
+ path: ../../pkgs/test_api
+ test_core:
+ path: ../../pkgs/test_core
diff --git a/integration_tests/nnbd_opted_in/test/common/is_opted_out.dart b/legacy_tests/nnbd_opted_in_with_optout/test/common/is_opted_out.dart
similarity index 100%
copy from integration_tests/nnbd_opted_in/test/common/is_opted_out.dart
copy to legacy_tests/nnbd_opted_in_with_optout/test/common/is_opted_out.dart
diff --git a/integration_tests/nnbd_opted_in/test/opted_out_test.dart b/legacy_tests/nnbd_opted_in_with_optout/test/opted_out_test.dart
similarity index 100%
rename from integration_tests/nnbd_opted_in/test/opted_out_test.dart
rename to legacy_tests/nnbd_opted_in_with_optout/test/opted_out_test.dart
diff --git a/integration_tests/nnbd_opted_out/mono_pkg.yaml b/legacy_tests/nnbd_opted_out/mono_pkg.yaml
similarity index 93%
rename from integration_tests/nnbd_opted_out/mono_pkg.yaml
rename to legacy_tests/nnbd_opted_out/mono_pkg.yaml
index dd4b62b..a8c8677 100644
--- a/integration_tests/nnbd_opted_out/mono_pkg.yaml
+++ b/legacy_tests/nnbd_opted_out/mono_pkg.yaml
@@ -1,7 +1,6 @@
# See https://pub.dev/packages/mono_repo
sdk:
-- dev
- 2.18.0
stages:
@@ -10,7 +9,7 @@
- format
- analyze: --fatal-infos
sdk:
- - dev
+ - stable
- unit_test:
- test: -p chrome,vm,node
os:
diff --git a/integration_tests/nnbd_opted_out/pubspec.yaml b/legacy_tests/nnbd_opted_out/pubspec.yaml
similarity index 100%
rename from integration_tests/nnbd_opted_out/pubspec.yaml
rename to legacy_tests/nnbd_opted_out/pubspec.yaml
diff --git a/integration_tests/nnbd_opted_out/test/common/is_opted_out.dart b/legacy_tests/nnbd_opted_out/test/common/is_opted_out.dart
similarity index 100%
rename from integration_tests/nnbd_opted_out/test/common/is_opted_out.dart
rename to legacy_tests/nnbd_opted_out/test/common/is_opted_out.dart
diff --git a/integration_tests/nnbd_opted_out/test/opted_in_test.dart b/legacy_tests/nnbd_opted_out/test/opted_in_test.dart
similarity index 100%
rename from integration_tests/nnbd_opted_out/test/opted_in_test.dart
rename to legacy_tests/nnbd_opted_out/test/opted_in_test.dart
diff --git a/integration_tests/nnbd_opted_out/test/opted_out_test.dart b/legacy_tests/nnbd_opted_out/test/opted_out_test.dart
similarity index 100%
rename from integration_tests/nnbd_opted_out/test/opted_out_test.dart
rename to legacy_tests/nnbd_opted_out/test/opted_out_test.dart
diff --git a/integration_tests/nnbd_opted_out/test/spawn_hybrid_code_test.dart b/legacy_tests/nnbd_opted_out/test/spawn_hybrid_code_test.dart
similarity index 100%
rename from integration_tests/nnbd_opted_out/test/spawn_hybrid_code_test.dart
rename to legacy_tests/nnbd_opted_out/test/spawn_hybrid_code_test.dart
diff --git a/integration_tests/nnbd_opted_in/mono_pkg.yaml b/legacy_tests/spawn_hybrid_with_optout/mono_pkg.yaml
similarity index 92%
copy from integration_tests/nnbd_opted_in/mono_pkg.yaml
copy to legacy_tests/spawn_hybrid_with_optout/mono_pkg.yaml
index 7d75b61..4ea5861 100644
--- a/integration_tests/nnbd_opted_in/mono_pkg.yaml
+++ b/legacy_tests/spawn_hybrid_with_optout/mono_pkg.yaml
@@ -1,7 +1,6 @@
# See https://pub.dev/packages/mono_repo
sdk:
-- dev
- pubspec
stages:
@@ -10,7 +9,7 @@
- format
- analyze: --fatal-infos
sdk:
- - dev
+ - stable
- unit_test:
- test: -p chrome,vm,node
os:
diff --git a/legacy_tests/spawn_hybrid_with_optout/pubspec.yaml b/legacy_tests/spawn_hybrid_with_optout/pubspec.yaml
new file mode 100644
index 0000000..d02bf9f
--- /dev/null
+++ b/legacy_tests/spawn_hybrid_with_optout/pubspec.yaml
@@ -0,0 +1,14 @@
+name: spawn_hybrid_with_optout
+publish_to: none
+environment:
+ sdk: '>=2.18.0 <3.0.0'
+dev_dependencies:
+ lints: '>=1.0.0 <3.0.0'
+ test: any
+dependency_overrides:
+ test:
+ path: ../../pkgs/test
+ test_api:
+ path: ../../pkgs/test_api
+ test_core:
+ path: ../../pkgs/test_core
diff --git a/legacy_tests/spawn_hybrid_with_optout/test/hybrid_test.dart b/legacy_tests/spawn_hybrid_with_optout/test/hybrid_test.dart
new file mode 100644
index 0000000..5e2ff41
--- /dev/null
+++ b/legacy_tests/spawn_hybrid_with_optout/test/hybrid_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2022, 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.
+
+import 'package:test/test.dart';
+
+void main() {
+ group('spawnHybridCode()', () {
+ test('can opt out of null safety', () async {
+ expect(spawnHybridCode('''
+ // @dart=2.9
+ import "package:stream_channel/stream_channel.dart";
+
+ // Would cause an error in null safety mode.
+ int x;
+
+ void hybridMain(StreamChannel channel) {
+ channel.sink..add(1)..add(2)..add(3)..close();
+ }
+ ''').stream.toList(), completion(equals([1, 2, 3])));
+ });
+
+ test('opts in to null safety by default', () async {
+ expect(spawnHybridCode('''
+ import "package:stream_channel/stream_channel.dart";
+
+ // Use some null safety syntax
+ int? x;
+
+ void hybridMain(StreamChannel channel) {
+ channel.sink..add(1)..add(2)..add(3)..close();
+ }
+ ''').stream.toList(), completion(equals([1, 2, 3])));
+ });
+ });
+}
diff --git a/integration_tests/nnbd_opted_in/mono_pkg.yaml b/legacy_tests/unit_tests/mono_repo.yaml
similarity index 92%
copy from integration_tests/nnbd_opted_in/mono_pkg.yaml
copy to legacy_tests/unit_tests/mono_repo.yaml
index 7d75b61..4ea5861 100644
--- a/integration_tests/nnbd_opted_in/mono_pkg.yaml
+++ b/legacy_tests/unit_tests/mono_repo.yaml
@@ -1,7 +1,6 @@
# See https://pub.dev/packages/mono_repo
sdk:
-- dev
- pubspec
stages:
@@ -10,7 +9,7 @@
- format
- analyze: --fatal-infos
sdk:
- - dev
+ - stable
- unit_test:
- test: -p chrome,vm,node
os:
diff --git a/legacy_tests/unit_tests/pubspec.yaml b/legacy_tests/unit_tests/pubspec.yaml
new file mode 100644
index 0000000..4703f1e
--- /dev/null
+++ b/legacy_tests/unit_tests/pubspec.yaml
@@ -0,0 +1,18 @@
+name: legacy_unit_tests
+publish_to: none
+environment:
+ sdk: '>=2.18.0 <3.0.0'
+dev_dependencies:
+ lints: '>=1.0.0 <3.0.0'
+ package_config: ^2.0.0
+ path: ^1.8.0
+ test: any
+ test_descriptor: ^2.0.0
+ test_process: ^2.0.0
+dependency_overrides:
+ test:
+ path: ../../pkgs/test
+ test_api:
+ path: ../../pkgs/test_api
+ test_core:
+ path: ../../pkgs/test_core
diff --git a/legacy_tests/unit_tests/test/io.dart b/legacy_tests/unit_tests/test/io.dart
new file mode 100644
index 0000000..b86b4c7
--- /dev/null
+++ b/legacy_tests/unit_tests/test/io.dart
@@ -0,0 +1,190 @@
+// Copyright (c) 2015, 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.
+
+import 'dart:async';
+import 'dart:io';
+import 'dart:isolate';
+
+import 'package:path/path.dart' as p;
+import 'package:test/test.dart';
+import 'package:test_descriptor/test_descriptor.dart' as d;
+import 'package:test_process/test_process.dart';
+
+/// The path to the root directory of the `test` package.
+final Future<String> packageDir =
+ Isolate.resolvePackageUri(Uri(scheme: 'package', path: 'test/'))
+ .then((uri) {
+ var dir = p.dirname(uri!.path);
+ // If it starts with a `/C:` or other drive letter, remove the leading `/`.
+ if (dir[0] == '/' && dir[2] == ':') dir = dir.substring(1);
+ return dir;
+});
+
+/// The path to the `pub` executable in the current Dart SDK.
+final _pubPath = p.absolute(p.join(p.dirname(Platform.resolvedExecutable),
+ Platform.isWindows ? 'pub.bat' : 'pub'));
+
+/// The platform-specific message emitted when a nonexistent file is loaded.
+final String noSuchFileMessage = Platform.isWindows
+ ? 'The system cannot find the file specified.'
+ : 'No such file or directory';
+
+/// A regular expression that matches the output of "pub serve".
+final _servingRegExp =
+ RegExp(r'^Serving myapp [a-z]+ on http://localhost:(\d+)$');
+
+/// An operating system name that's different than the current operating system.
+final otherOS = Platform.isWindows ? 'mac-os' : 'windows';
+
+/// The port of a pub serve instance run via [runPubServe].
+///
+/// This is only set after [runPubServe] is called.
+int get pubServePort => _pubServePort!;
+int? _pubServePort;
+
+/// Expects that the entire stdout stream of [test] equals [expected].
+void expectStdoutEquals(TestProcess test, String expected) =>
+ _expectStreamEquals(test.stdoutStream(), expected);
+
+/// Expects that the entire stderr stream of [test] equals [expected].
+void expectStderrEquals(TestProcess test, String expected) =>
+ _expectStreamEquals(test.stderrStream(), expected);
+
+/// Expects that the entirety of the line stream [stream] equals [expected].
+void _expectStreamEquals(Stream<String> stream, String expected) {
+ expect((() async {
+ var lines = await stream.toList();
+ expect(lines.join('\n').trim(), equals(expected.trim()));
+ })(), completes);
+}
+
+/// Returns a [StreamMatcher] that asserts that the stream emits strings
+/// containing each string in [strings] in order.
+///
+/// This expects each string in [strings] to match a different string in the
+/// stream.
+StreamMatcher containsInOrder(Iterable<String> strings) =>
+ emitsInOrder(strings.map((string) => emitsThrough(contains(string))));
+
+/// Lazily compile the test package to kernel and re-use that, initialized with
+/// [precompileTestExecutable].
+String? _testExecutablePath;
+
+/// Must be invoked before any call to [runTests], should be invoked in a top
+/// level `setUpAll` for best caching results.
+Future<void> precompileTestExecutable() async {
+ if (_testExecutablePath != null) {
+ throw StateError('Test executable already precompiled');
+ }
+ var tmpDirectory = await Directory.systemTemp.createTemp('test');
+ var precompiledPath = p.join(tmpDirectory.path, 'test_runner.dill');
+ var result = await Process.run(Platform.executable, [
+ 'compile',
+ 'kernel',
+ p.url.join(await packageDir, 'bin', 'test.dart'),
+ '-o',
+ precompiledPath,
+ ]);
+ if (result.exitCode != 0) {
+ throw StateError(
+ 'Failed to compile test runner:\n${result.stdout}\n${result.stderr}');
+ }
+
+ addTearDown(() async {
+ await tmpDirectory.delete(recursive: true);
+ });
+ _testExecutablePath = precompiledPath;
+}
+
+/// Runs the test executable with the package root set properly.
+///
+/// You must invoke [precompileTestExecutable] before invoking this function.
+Future<TestProcess> runTest(Iterable<String> args,
+ {String? reporter,
+ String? fileReporter,
+ int? concurrency,
+ Map<String, String>? environment,
+ bool forwardStdio = false,
+ String? packageConfig,
+ Iterable<String>? vmArgs}) async {
+ concurrency ??= 1;
+ var testExecutablePath = _testExecutablePath;
+ if (testExecutablePath == null) {
+ throw StateError(
+ 'You must call `precompileTestExecutable` before calling `runTest`');
+ }
+
+ var allArgs = [
+ ...?vmArgs,
+ testExecutablePath,
+ '--concurrency=$concurrency',
+ if (reporter != null) '--reporter=$reporter',
+ if (fileReporter != null) '--file-reporter=$fileReporter',
+ ...args,
+ ];
+
+ environment ??= {};
+ environment.putIfAbsent('_DART_TEST_TESTING', () => 'true');
+
+ return await runDart(allArgs,
+ environment: environment,
+ description: 'dart bin/test.dart',
+ forwardStdio: forwardStdio,
+ packageConfig: packageConfig);
+}
+
+/// Runs Dart.
+///
+/// If [packageConfig] is provided then that is passed for the `--packages`
+/// arg, otherwise the current isolate config is passed.
+Future<TestProcess> runDart(Iterable<String> args,
+ {Map<String, String>? environment,
+ String? description,
+ bool forwardStdio = false,
+ String? packageConfig}) async {
+ var allArgs = <String>[
+ ...Platform.executableArguments.where((arg) =>
+ !arg.startsWith('--package-root=') && !arg.startsWith('--packages=')),
+ '--packages=${packageConfig ?? await Isolate.packageConfig}',
+ ...args
+ ];
+
+ return await TestProcess.start(
+ p.absolute(Platform.resolvedExecutable), allArgs,
+ workingDirectory: d.sandbox,
+ environment: environment,
+ description: description,
+ forwardStdio: forwardStdio);
+}
+
+/// Runs Pub.
+Future<TestProcess> runPub(Iterable<String> args,
+ {Map<String, String>? environment}) {
+ return TestProcess.start(_pubPath, args,
+ workingDirectory: d.sandbox,
+ environment: environment,
+ description: 'pub ${args.first}');
+}
+
+/// Runs "pub serve".
+///
+/// This returns assigns [_pubServePort] to a future that will complete to the
+/// port of the "pub serve" instance.
+Future<TestProcess> runPubServe(
+ {Iterable<String>? args,
+ String? workingDirectory,
+ Map<String, String>? environment}) async {
+ var allArgs = ['serve', '--port', '0'];
+ if (args != null) allArgs.addAll(args);
+
+ var pub = await runPub(allArgs, environment: environment);
+
+ Match? match;
+ while (match == null) {
+ match = _servingRegExp.firstMatch(await pub.stdout.next);
+ }
+ _pubServePort = int.parse(match[1]!);
+
+ return pub;
+}
diff --git a/legacy_tests/unit_tests/test/runner_test.dart b/legacy_tests/unit_tests/test/runner_test.dart
new file mode 100644
index 0000000..5f67759
--- /dev/null
+++ b/legacy_tests/unit_tests/test/runner_test.dart
@@ -0,0 +1,118 @@
+import 'dart:convert';
+import 'dart:isolate';
+
+import 'package:package_config/package_config.dart';
+import 'package:path/path.dart' as p;
+import 'package:test/test.dart';
+import 'package:test_descriptor/test_descriptor.dart' as d;
+
+import 'io.dart';
+
+void main() {
+ setUpAll(precompileTestExecutable);
+
+ group('nnbd', () {
+ final testContents = '''
+import 'package:test/test.dart';
+import 'opted_out.dart';
+
+void main() {
+ test("success", () {
+ expect(foo, true);
+ });
+}''';
+
+ setUp(() async {
+ await d.file('opted_out.dart', '''
+// @dart=2.8
+final foo = true;''').create();
+ });
+
+ test('sound null safety is enabled if the entrypoint opts in explicitly',
+ () async {
+ await d.file('test.dart', '''
+// @dart=2.12
+$testContents
+''').create();
+ var test = await runTest(['test.dart']);
+
+ expect(
+ test.stdout,
+ emitsThrough(contains(
+ 'Error: A library can\'t opt out of null safety by default, '
+ 'when using sound null safety.')));
+ await test.shouldExit(1);
+ });
+
+ test('sound null safety is disabled if the entrypoint opts out explicitly',
+ () async {
+ await d.file('test.dart', '''
+// @dart=2.8
+$testContents''').create();
+ var test = await runTest(['test.dart']);
+
+ expect(test.stdout, emitsThrough(contains('+1: All tests passed!')));
+ await test.shouldExit(0);
+ });
+
+ group('defaults', () {
+ late PackageConfig currentPackageConfig;
+
+ setUpAll(() async {
+ currentPackageConfig =
+ await loadPackageConfigUri((await Isolate.packageConfig)!);
+ });
+
+ setUp(() async {
+ await d.file('test.dart', testContents).create();
+ });
+
+ test('sound null safety is enabled if the package is opted in', () async {
+ var newPackageConfig = PackageConfig([
+ ...currentPackageConfig.packages,
+ Package('example', Uri.file('${d.sandbox}/'),
+ languageVersion: LanguageVersion(2, 12),
+ // TODO: https://github.com/dart-lang/package_config/issues/81
+ packageUriRoot: Uri.file('${d.sandbox}/')),
+ ]);
+
+ await d
+ .file('package_config.json',
+ jsonEncode(PackageConfig.toJson(newPackageConfig)))
+ .create();
+
+ var test = await runTest(['test.dart'],
+ packageConfig: p.join(d.sandbox, 'package_config.json'));
+
+ expect(
+ test.stdout,
+ emitsThrough(contains(
+ 'Error: A library can\'t opt out of null safety by default, '
+ 'when using sound null safety.')));
+ await test.shouldExit(1);
+ });
+
+ test('sound null safety is disabled if the package is opted out',
+ () async {
+ var newPackageConfig = PackageConfig([
+ ...currentPackageConfig.packages,
+ Package('example', Uri.file('${d.sandbox}/'),
+ languageVersion: LanguageVersion(2, 8),
+ // TODO: https://github.com/dart-lang/package_config/issues/81
+ packageUriRoot: Uri.file('${d.sandbox}/')),
+ ]);
+
+ await d
+ .file('package_config.json',
+ jsonEncode(PackageConfig.toJson(newPackageConfig)))
+ .create();
+
+ var test = await runTest(['test.dart'],
+ packageConfig: p.join(d.sandbox, 'package_config.json'));
+
+ expect(test.stdout, emitsThrough(contains('+1: All tests passed!')));
+ await test.shouldExit(0);
+ });
+ });
+ });
+}
diff --git a/pkgs/test/CHANGELOG.md b/pkgs/test/CHANGELOG.md
index 96e3523..d2694ee 100644
--- a/pkgs/test/CHANGELOG.md
+++ b/pkgs/test/CHANGELOG.md
@@ -5,6 +5,11 @@
time with all the test cases across the different arguments.
* Fix VM tests which run after some test has changed the working directory.
There are still issues with browser tests after changing directory.
+* Deprecate `throwsNullThrownError`, use `throwsA(isA<TypeError>())` instead. The
+ implementation has been changed to ease migrations.
+* Deprecate `throwsCyclicInitializationError` and replace the implementation
+ with `Throws(TypeMatcher<Error>())`. The specific exception no longer exists
+ and there is no guarantee about what type of error will be thrown.
## 1.22.0
diff --git a/pkgs/test/pubspec.yaml b/pkgs/test/pubspec.yaml
index 414cff1..bd2b19a 100644
--- a/pkgs/test/pubspec.yaml
+++ b/pkgs/test/pubspec.yaml
@@ -32,7 +32,7 @@
webkit_inspection_protocol: ^1.0.0
yaml: ^3.0.0
# Use an exact version until the test_api and test_core package are stable.
- test_api: 0.4.16
+ test_api: 0.4.17
test_core: 0.4.21
dev_dependencies:
diff --git a/pkgs/test/test/runner/runner_test.dart b/pkgs/test/test/runner/runner_test.dart
index 248fd66..19419af 100644
--- a/pkgs/test/test/runner/runner_test.dart
+++ b/pkgs/test/test/runner/runner_test.dart
@@ -4,13 +4,9 @@
@TestOn('vm')
-import 'dart:convert';
import 'dart:io';
-import 'dart:isolate';
import 'dart:math' as math;
-import 'package:package_config/package_config.dart';
-import 'package:path/path.dart' as p;
import 'package:test/test.dart';
import 'package:test_core/src/util/exit_codes.dart' as exit_codes;
import 'package:test_descriptor/test_descriptor.dart' as d;
@@ -751,111 +747,6 @@
'windows': Skip('https://github.com/dart-lang/test/issues/1615')
});
- group('nnbd', () {
- final testContents = '''
-import 'package:test/test.dart';
-import 'opted_out.dart';
-
-void main() {
- test("success", () {
- expect(foo, true);
- });
-}''';
-
- setUp(() async {
- await d.file('opted_out.dart', '''
-// @dart=2.8
-final foo = true;''').create();
- });
-
- test('sound null safety is enabled if the entrypoint opts in explicitly',
- () async {
- await d.file('test.dart', '''
-// @dart=2.12
-$testContents
-''').create();
- var test = await runTest(['test.dart']);
-
- expect(
- test.stdout,
- emitsThrough(contains(
- 'Error: A library can\'t opt out of null safety by default, '
- 'when using sound null safety.')));
- await test.shouldExit(1);
- });
-
- test('sound null safety is disabled if the entrypoint opts out explicitly',
- () async {
- await d.file('test.dart', '''
-// @dart=2.8
-$testContents''').create();
- var test = await runTest(['test.dart']);
-
- expect(test.stdout, emitsThrough(contains('+1: All tests passed!')));
- await test.shouldExit(0);
- });
-
- group('defaults', () {
- late PackageConfig currentPackageConfig;
-
- setUpAll(() async {
- currentPackageConfig =
- await loadPackageConfigUri((await Isolate.packageConfig)!);
- });
-
- setUp(() async {
- await d.file('test.dart', testContents).create();
- });
-
- test('sound null safety is enabled if the package is opted in', () async {
- var newPackageConfig = PackageConfig([
- ...currentPackageConfig.packages,
- Package('example', Uri.file('${d.sandbox}/'),
- languageVersion: LanguageVersion(2, 12),
- // TODO: https://github.com/dart-lang/package_config/issues/81
- packageUriRoot: Uri.file('${d.sandbox}/')),
- ]);
-
- await d
- .file('package_config.json',
- jsonEncode(PackageConfig.toJson(newPackageConfig)))
- .create();
-
- var test = await runTest(['test.dart'],
- packageConfig: p.join(d.sandbox, 'package_config.json'));
-
- expect(
- test.stdout,
- emitsThrough(contains(
- 'Error: A library can\'t opt out of null safety by default, '
- 'when using sound null safety.')));
- await test.shouldExit(1);
- });
-
- test('sound null safety is disabled if the package is opted out',
- () async {
- var newPackageConfig = PackageConfig([
- ...currentPackageConfig.packages,
- Package('example', Uri.file('${d.sandbox}/'),
- languageVersion: LanguageVersion(2, 8),
- // TODO: https://github.com/dart-lang/package_config/issues/81
- packageUriRoot: Uri.file('${d.sandbox}/')),
- ]);
-
- await d
- .file('package_config.json',
- jsonEncode(PackageConfig.toJson(newPackageConfig)))
- .create();
-
- var test = await runTest(['test.dart'],
- packageConfig: p.join(d.sandbox, 'package_config.json'));
-
- expect(test.stdout, emitsThrough(contains('+1: All tests passed!')));
- await test.shouldExit(0);
- });
- });
- });
-
group('language experiments', () {
group('are inherited from the executable arguments', () {
setUp(() async {
@@ -887,7 +778,7 @@
await expectLater(
test.stdout, emitsThrough(contains('+1: All tests passed!')));
await test.shouldExit(0);
- });
+ }, skip: 'https://github.com/dart-lang/test/issues/1813');
}
});
});
diff --git a/pkgs/test_api/CHANGELOG.md b/pkgs/test_api/CHANGELOG.md
index 34fa621..772669c 100644
--- a/pkgs/test_api/CHANGELOG.md
+++ b/pkgs/test_api/CHANGELOG.md
@@ -1,5 +1,11 @@
## 0.4.17-dev
+* Deprecate `throwsNullThrownError`, use `throwsA(isA<TypeError>())` instead.
+ The implementation has been changed to ease migrations.
+* Deprecate `throwsCyclicInitializationError` and replace the implementation
+ with `Throws(TypeMatcher<Error>())`. The specific exception no longer exists
+ and there is no guarantee about what type of error will be thrown.
+
## 0.4.16
* Add the `experimental-chrome-wasm` runtime. This is very unstable and will
diff --git a/pkgs/test_api/lib/src/expect/throws_matchers.dart b/pkgs/test_api/lib/src/expect/throws_matchers.dart
index b80f3af..edf777b 100644
--- a/pkgs/test_api/lib/src/expect/throws_matchers.dart
+++ b/pkgs/test_api/lib/src/expect/throws_matchers.dart
@@ -20,8 +20,10 @@
/// A matcher for functions that throw CyclicInitializationError.
///
/// See [throwsA] for objects that this can be matched against.
-const Matcher throwsCyclicInitializationError =
- Throws(isCyclicInitializationError);
+@Deprecated('throwsCyclicInitializationError has been deprecated, because '
+ 'the type will longer exists in Dart 3.0. It will now catch any kind of '
+ 'error, not only CyclicInitializationError.')
+const Matcher throwsCyclicInitializationError = Throws(TypeMatcher<Error>());
/// A matcher for functions that throw Exception.
///
@@ -41,7 +43,10 @@
/// A matcher for functions that throw NullThrownError.
///
/// See [throwsA] for objects that this can be matched against.
-const Matcher throwsNullThrownError = Throws(isNullThrownError);
+@Deprecated('throwsNullThrownError has been deprecated, because '
+ 'NullThrownError has been replaced with TypeError. '
+ 'Use `throwsA(isA<TypeError>())` instead.')
+const Matcher throwsNullThrownError = Throws(TypeMatcher<TypeError>());
/// A matcher for functions that throw RangeError.
///
diff --git a/pkgs/test_api/pubspec.yaml b/pkgs/test_api/pubspec.yaml
index 9990d51..447fec4 100644
--- a/pkgs/test_api/pubspec.yaml
+++ b/pkgs/test_api/pubspec.yaml
@@ -20,7 +20,7 @@
# Use a tight version constraint to ensure that a constraint on matcher
# properly constrains all features it provides.
- matcher: '>=0.12.11 <0.12.14'
+ matcher: '>=0.12.11 <0.12.15'
dev_dependencies:
analyzer: '>=2.1.0 <6.0.0'
diff --git a/pkgs/test_api/test/frontend/matcher/throws_type_test.dart b/pkgs/test_api/test/frontend/matcher/throws_type_test.dart
index 1166ad8..6e0a482 100644
--- a/pkgs/test_api/test/frontend/matcher/throws_type_test.dart
+++ b/pkgs/test_api/test/frontend/matcher/throws_type_test.dart
@@ -42,8 +42,9 @@
group('[throwsCyclicInitializationError]', () {
test('passes when a CyclicInitializationError is thrown', () {
- // ignore: deprecated_member_use
- expect(() => throw CyclicInitializationError(''),
+ expect(
+ () => _CyclicInitializationFailure().x,
+ // ignore: deprecated_member_use
throwsCyclicInitializationError);
});
@@ -53,9 +54,7 @@
});
expectTestFailed(
- liveTest,
- startsWith(
- "Expected: throws <Instance of 'CyclicInitializationError'>"));
+ liveTest, startsWith("Expected: throws <Instance of 'Error'>"));
});
});
@@ -106,26 +105,6 @@
});
});
- group('[throwsNullThrownError]', () {
- test('passes when a NullThrownError is thrown', () {
- // Throwing null is no longer allowed with NNBD, but we do want to allow
- // it from legacy code and should be able to catch those errors.
- // ignore: deprecated_member_use
- expect(() => throw NullThrownError(), throwsNullThrownError);
- });
-
- test('fails when a non-NullThrownError is thrown', () async {
- var liveTest = await runTestBody(() {
- expect(() => throw Exception(), throwsNullThrownError);
- });
-
- expectTestFailed(
- liveTest,
- // ignore: deprecated_member_use
- startsWith("Expected: throws <Instance of '$NullThrownError'>"));
- });
- });
-
group('[throwsRangeError]', () {
test('passes when a RangeError is thrown', () {
expect(() => throw RangeError(''), throwsRangeError);
@@ -186,3 +165,8 @@
});
});
}
+
+class _CyclicInitializationFailure {
+ late int x = y;
+ late int y = x;
+}
diff --git a/pkgs/test_core/pubspec.yaml b/pkgs/test_core/pubspec.yaml
index 407744a..f38443b 100644
--- a/pkgs/test_core/pubspec.yaml
+++ b/pkgs/test_core/pubspec.yaml
@@ -30,7 +30,7 @@
# matcher is tightly constrained by test_api
matcher: any
# Use an exact version until the test_api package is stable.
- test_api: 0.4.16
+ test_api: 0.4.17
dev_dependencies:
lints: '>=1.0.0 <3.0.0'