diff --git a/pkgs/test/CHANGELOG.md b/pkgs/test/CHANGELOG.md index eacfc5479..c200b2189 100644 --- a/pkgs/test/CHANGELOG.md +++ b/pkgs/test/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.25.11 + +* Update to be forward compatible with `package:shelf_web_socket` version `3.x`. + ## 1.25.10 * Update the `package:vm_service` constraint to allow version `15.x`. diff --git a/pkgs/test/README.md b/pkgs/test/README.md index 166a371cd..36103d9c1 100644 --- a/pkgs/test/README.md +++ b/pkgs/test/README.md @@ -798,7 +798,7 @@ import 'package:stream_channel/stream_channel.dart'; // returned spawnHybridCode(). hybridMain(StreamChannel channel) async { // Start a WebSocket server that just sends "hello!" to its clients. - var server = await io.serve(webSocketHandler((webSocket) { + var server = await io.serve(webSocketHandler((webSocket, _) { webSocket.sink.add('hello!'); }), 'localhost', 0); diff --git a/pkgs/test/lib/src/runner/browser/compilers/dart2js.dart b/pkgs/test/lib/src/runner/browser/compilers/dart2js.dart index 2c26ed0ea..3cd67453b 100644 --- a/pkgs/test/lib/src/runner/browser/compilers/dart2js.dart +++ b/pkgs/test/lib/src/runner/browser/compilers/dart2js.dart @@ -174,7 +174,12 @@ class Dart2JsSupport extends CompilerSupport with JsHtmlWrapper { @override (Uri, Future) get webSocket { var completer = Completer.sync(); - var path = _webSocketHandler.create(webSocketHandler(completer.complete)); + // Note: the WebSocketChannel type below is needed for compatibility with + // package:shelf_web_socket v2. + var path = + _webSocketHandler.create(webSocketHandler((WebSocketChannel ws, _) { + completer.complete(ws); + })); var webSocketUrl = serverUrl.replace(scheme: 'ws').resolve(path); return (webSocketUrl, completer.future); } diff --git a/pkgs/test/lib/src/runner/browser/compilers/dart2wasm.dart b/pkgs/test/lib/src/runner/browser/compilers/dart2wasm.dart index 697a9c50b..31ad66152 100644 --- a/pkgs/test/lib/src/runner/browser/compilers/dart2wasm.dart +++ b/pkgs/test/lib/src/runner/browser/compilers/dart2wasm.dart @@ -180,7 +180,12 @@ class Dart2WasmSupport extends CompilerSupport with WasmHtmlWrapper { @override (Uri, Future) get webSocket { var completer = Completer.sync(); - var path = _webSocketHandler.create(webSocketHandler(completer.complete)); + // Note: the WebSocketChannel type below is needed for compatibility with + // package:shelf_web_socket v2. + var path = + _webSocketHandler.create(webSocketHandler((WebSocketChannel ws, _) { + completer.complete(ws); + })); var webSocketUrl = serverUrl.replace(scheme: 'ws').resolve(path); return (webSocketUrl, completer.future); } diff --git a/pkgs/test/lib/src/runner/browser/compilers/precompiled.dart b/pkgs/test/lib/src/runner/browser/compilers/precompiled.dart index f4c6a7a7e..9cf44aaf4 100644 --- a/pkgs/test/lib/src/runner/browser/compilers/precompiled.dart +++ b/pkgs/test/lib/src/runner/browser/compilers/precompiled.dart @@ -137,7 +137,12 @@ abstract class PrecompiledSupport extends CompilerSupport { @override (Uri, Future) get webSocket { var completer = Completer.sync(); - var path = _webSocketHandler.create(webSocketHandler(completer.complete)); + // Note: the WebSocketChannel type below is needed for compatibility with + // package:shelf_web_socket v2. + var path = + _webSocketHandler.create(webSocketHandler((WebSocketChannel ws, _) { + completer.complete(ws); + })); var webSocketUrl = serverUrl.replace(scheme: 'ws').resolve(path); return (webSocketUrl, completer.future); } diff --git a/pkgs/test/pubspec.yaml b/pkgs/test/pubspec.yaml index 795a3ac71..a66e59271 100644 --- a/pkgs/test/pubspec.yaml +++ b/pkgs/test/pubspec.yaml @@ -1,5 +1,5 @@ name: test -version: 1.25.10 +version: 1.25.11 description: >- A full featured library for writing and running Dart tests across platforms. repository: https://github.com/dart-lang/test/tree/master/pkgs/test diff --git a/pkgs/test/test/runner/browser/code_server.dart b/pkgs/test/test/runner/browser/code_server.dart index 85705cc0e..1aba5dea5 100644 --- a/pkgs/test/test/runner/browser/code_server.dart +++ b/pkgs/test/test/runner/browser/code_server.dart @@ -59,7 +59,11 @@ class CodeServer { /// future that will complete to the WebSocket. Future handleWebSocket() { var completer = Completer(); - _handler.expect('GET', '/', webSocketHandler(completer.complete)); + // Note: the WebSocketChannel type below is needed for compatibility with + // package:shelf_web_socket v2. + _handler.expect('GET', '/', webSocketHandler((WebSocketChannel ws, _) { + completer.complete(ws); + })); return completer.future; } }