From 66ff778602f33a31cbd6bb4f0adc82f3a640e96d Mon Sep 17 00:00:00 2001 From: xubaolin Date: Tue, 12 Oct 2021 01:18:04 +0800 Subject: [PATCH] Do not output the error msg to the console when run a throwable test (#91593) --- packages/flutter/test/material/bottom_sheet_test.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/flutter/test/material/bottom_sheet_test.dart b/packages/flutter/test/material/bottom_sheet_test.dart index e5f9398790..e3a569f771 100644 --- a/packages/flutter/test/material/bottom_sheet_test.dart +++ b/packages/flutter/test/material/bottom_sheet_test.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -38,9 +39,16 @@ void main() { ), ); + final FlutterExceptionHandler? handler = FlutterError.onError; + FlutterErrorDetails? error; + FlutterError.onError = (FlutterErrorDetails details) { + error = details; + }; + await tester.drag(find.text('BottomSheet'), const Offset(0.0, 150.0)); - expect(tester.takeException(), isNotNull); + expect(error, isNotNull); + FlutterError.onError = handler; }); testWidgets('Tapping on a modal BottomSheet should not dismiss it', (WidgetTester tester) async {