migrate to runZonedGuarded (#1368)

diff --git a/pkgs/test/lib/src/runner/browser/browser.dart b/pkgs/test/lib/src/runner/browser/browser.dart
index 44ec2fa..c65962c 100644
--- a/pkgs/test/lib/src/runner/browser/browser.dart
+++ b/pkgs/test/lib/src/runner/browser/browser.dart
@@ -8,7 +8,6 @@
 import 'dart:convert';
 import 'dart:io';
 
-import 'package:stack_trace/stack_trace.dart';
 import 'package:typed_data/typed_data.dart';
 
 import 'package:test_api/src/utils.dart'; // ignore: implementation_imports
@@ -66,7 +65,7 @@
     // Don't return a Future here because there's no need for the caller to wait
     // for the process to actually start. They should just wait for the HTTP
     // request instead.
-    runZoned(() async {
+    runZonedGuarded(() async {
       var process = await startBrowser();
       _processCompleter.complete(process);
 
@@ -109,14 +108,13 @@
       }
 
       _onExitCompleter.complete();
-    }, onError: (error, StackTrace stackTrace) {
+    }, (error, stackTrace) {
       // Ignore any errors after the browser has been closed.
       if (_closed) return;
 
       // Make sure the process dies even if the error wasn't fatal.
       _process.then((process) => process.kill());
 
-      stackTrace ??= Trace.current();
       if (_onExitCompleter.isCompleted) return;
       _onExitCompleter.completeError(
           ApplicationException(
diff --git a/pkgs/test/tool/host.dart b/pkgs/test/tool/host.dart
index d436ab2..a59f2f9 100644
--- a/pkgs/test/tool/host.dart
+++ b/pkgs/test/tool/host.dart
@@ -117,7 +117,7 @@
     document.body.classes.add('debug');
   }
 
-  runZoned(() {
+  runZonedGuarded(() {
     var serverChannel = _connectToServer();
     serverChannel.stream.listen((message) {
       if (message['command'] == 'loadSuite') {
@@ -157,7 +157,7 @@
     }), restartCurrent: allowInterop(() {
       serverChannel.sink.add({'command': 'restart'});
     }));
-  }, onError: (error, StackTrace stackTrace) {
+  }, (error, stackTrace) {
     print('$error\n${Trace.from(stackTrace).terse}');
   });
 }