diff --git a/pkgs/test_api/CHANGELOG.md b/pkgs/test_api/CHANGELOG.md index 0208cbf5d..a813dca9e 100644 --- a/pkgs/test_api/CHANGELOG.md +++ b/pkgs/test_api/CHANGELOG.md @@ -1,7 +1,9 @@ ## 0.7.8-wip +* Add a zone function available from the test suite `main` that allows creating + channels to the test runner. * Restrict to latest version of analyzer package. -- Require Dart 3.7 +* Require Dart 3.7 ## 0.7.7 diff --git a/pkgs/test_api/lib/src/backend/declarer.dart b/pkgs/test_api/lib/src/backend/declarer.dart index 4551a7d9f..7f9e4df3b 100644 --- a/pkgs/test_api/lib/src/backend/declarer.dart +++ b/pkgs/test_api/lib/src/backend/declarer.dart @@ -191,8 +191,8 @@ class Declarer { /// Runs [body] with this declarer as [Declarer.current]. /// /// Returns the return value of [body]. - T declare(T Function() body) => - runZoned(body, zoneValues: {#test.declarer: this}); + T declare(T Function() body, {Map? zoneValues}) => + runZoned(body, zoneValues: {#test.declarer: this, ...?zoneValues}); /// Defines a test case with the given name and body. void test( diff --git a/pkgs/test_api/lib/src/backend/remote_listener.dart b/pkgs/test_api/lib/src/backend/remote_listener.dart index eb6fb343e..1f58c2574 100644 --- a/pkgs/test_api/lib/src/backend/remote_listener.dart +++ b/pkgs/test_api/lib/src/backend/remote_listener.dart @@ -133,7 +133,12 @@ final class RemoteListener { await beforeLoad(suiteChannelManager.connectOut); } - await declarer.declare(main); + await declarer.declare( + main, + zoneValues: { + #test.openChannelCallback: suiteChannelManager.connectOut, + }, + ); var suite = Suite( declarer.build(),