From 8322e178fab00438cd713f67f9c2c99898a2660d Mon Sep 17 00:00:00 2001 From: Darren Austin Date: Mon, 2 Aug 2021 18:05:04 -0700 Subject: [PATCH] Revert "Added 'exclude' parameter to 'testWidgets()'. (#86397)" (#87515) --- .../flutter_test/lib/src/widget_tester.dart | 27 ++----------------- .../flutter_test/test/widget_tester_test.dart | 10 ------- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart index 7cbcf52a8b..946a7749ed 100644 --- a/packages/flutter_test/lib/src/widget_tester.dart +++ b/packages/flutter_test/lib/src/widget_tester.dart @@ -115,14 +115,6 @@ E? _lastWhereOrNull(Iterable list, bool Function(E) test) { /// each value of the [TestVariant.values]. If [variant] is not set, the test /// will be run once using the base test environment. /// -/// If either [exclude] or [skip] is `true`, then the test will be skipped. The -/// difference is that [skip] is a temporary way to disable a problematic test -/// while a fix is being developed. It should have a comment after it with a -/// link to a tracking issue for the work on re-enabling the test. -/// -/// [exclude] is used to indicate that the test is not designed to run under -/// the condition given and should always be skipped when it is `true`. -/// /// If the [tags] are passed, they declare user-defined tags that are implemented by /// the `test` package. /// @@ -140,26 +132,11 @@ E? _lastWhereOrNull(Iterable list, bool Function(E) test) { /// expect(find.text('Success'), findsOneWidget); /// }); /// ``` -/// -/// ### Excluded test -/// ```dart -/// testWidgets('Some test that will never make sense for the web', (WidgetTester tester) async { -/// // test code -/// }, exclude: isBrowser); -/// ``` -/// -/// ### Skipped test -/// ```dart -/// testWidgets('Some flaky test', (WidgetTester tester) async { -/// // test code -/// }, skip: true); // https://github.com/flutter/flutter/issues/12345 -/// ``` @isTest void testWidgets( String description, WidgetTesterCallback callback, { - bool skip = false, - bool exclude = false, + bool? skip, test_package.Timeout? timeout, Duration? initialTimeout, bool semanticsEnabled = true, @@ -207,7 +184,7 @@ void testWidgets( timeout: initialTimeout, ); }, - skip: (exclude || skip) ? true : null, + skip: skip, timeout: timeout ?? binding.defaultTestTimeout, tags: tags, ); diff --git a/packages/flutter_test/test/widget_tester_test.dart b/packages/flutter_test/test/widget_tester_test.dart index ebdcd61d2d..e3ce3274d3 100644 --- a/packages/flutter_test/test/widget_tester_test.dart +++ b/packages/flutter_test/test/widget_tester_test.dart @@ -738,16 +738,6 @@ void main() { }); }); - group('Skip and exclude work', () { - testWidgets('skipping a test skips it', (WidgetTester tester) async { - expect(true, false); // shouldn't get here - }, skip: true); // https://github.com/someissue - - testWidgets('excluding a test skips it', (WidgetTester tester) async { - expect(true, false); // shouldn't get here - }, exclude: true); - }); - group('Pending timer', () { late TestExceptionReporter currentExceptionReporter; setUp(() {