diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart index 1627c190d8..070f7eda9f 100644 --- a/packages/flutter_tools/lib/src/commands/test.dart +++ b/packages/flutter_tools/lib/src/commands/test.dart @@ -273,10 +273,19 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts { ..addOption( 'timeout', help: - 'The default test timeout, specified either ' - 'in seconds (e.g. "60s"), ' - 'as a multiplier of the default timeout (e.g. "2x"), ' - 'or as the string "none" to disable the timeout entirely.', + 'The default timeout for individual tests, specified either in ' + 'seconds (e.g. "60s"), as a multiplier of the default test timeout ' + '(e.g. "2x"), or as the string "none" to disable test timeouts ' + 'entirely. This value does not apply to the default test suite ' + 'loading timeout.', + ) + ..addFlag( + 'ignore-timeouts', + help: + 'Ignore all timeouts. Useful when testing a big application ' + 'that requires a longer time to compile (e.g. running integration ' + 'tests for a Flutter app).', + negatable: false, ) ..addFlag( FlutterOptions.kWebWasmFlag, @@ -647,6 +656,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts { reporter: stringArg('reporter'), fileReporter: stringArg('file-reporter'), timeout: stringArg('timeout'), + ignoreTimeouts: boolArg('ignore-timeouts'), failFast: boolArg('fail-fast'), runSkipped: boolArg('run-skipped'), shardIndex: shardIndex, @@ -675,6 +685,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts { reporter: stringArg('reporter'), fileReporter: stringArg('file-reporter'), timeout: stringArg('timeout'), + ignoreTimeouts: boolArg('ignore-timeouts'), failFast: boolArg('fail-fast'), runSkipped: boolArg('run-skipped'), shardIndex: shardIndex, diff --git a/packages/flutter_tools/lib/src/test/runner.dart b/packages/flutter_tools/lib/src/test/runner.dart index 944474faec..12a98f0b69 100644 --- a/packages/flutter_tools/lib/src/test/runner.dart +++ b/packages/flutter_tools/lib/src/test/runner.dart @@ -55,6 +55,7 @@ interface class FlutterTestRunner { String? reporter, String? fileReporter, String? timeout, + bool ignoreTimeouts = false, bool failFast = false, bool runSkipped = false, int? shardIndex, @@ -75,6 +76,7 @@ interface class FlutterTestRunner { if (machine) ...['-r', 'json'] else if (reporter != null) ...['-r', reporter], if (fileReporter != null) '--file-reporter=$fileReporter', if (timeout != null) ...['--timeout', timeout], + if (ignoreTimeouts) '--ignore-timeouts', if (concurrency != null) '--concurrency=$concurrency', for (final String name in names) ...['--name', name], for (final String plainName in plainNames) ...['--plain-name', plainName], @@ -588,6 +590,7 @@ class SpawnPlugin extends PlatformPlugin { String? reporter, String? fileReporter, String? timeout, + bool ignoreTimeouts = false, bool failFast = false, bool runSkipped = false, int? shardIndex, @@ -637,6 +640,7 @@ class SpawnPlugin extends PlatformPlugin { if (machine) ...['-r', 'json'] else if (reporter != null) ...['-r', reporter], if (fileReporter != null) '--file-reporter=$fileReporter', if (timeout != null) ...['--timeout', timeout], + if (ignoreTimeouts) '--ignore-timeouts', if (concurrency != null) '--concurrency=$concurrency', for (final String name in names) ...['--name', name], for (final String plainName in plainNames) ...['--plain-name', plainName], diff --git a/packages/flutter_tools/test/commands.shard/hermetic/test_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/test_test.dart index 175ed0d31f..7b87fc3222 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/test_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/test_test.dart @@ -157,6 +157,7 @@ dev_dependencies: expect(fakePackageTest.lastArgs, isNot(contains('compact'))); expect(fakePackageTest.lastArgs, isNot(contains('--timeout'))); expect(fakePackageTest.lastArgs, isNot(contains('30s'))); + expect(fakePackageTest.lastArgs, isNot(contains('--ignore-timeouts'))); expect(fakePackageTest.lastArgs, isNot(contains('--concurrency'))); }, overrides: { @@ -583,6 +584,7 @@ dev_dependencies: '--reporter=compact', '--file-reporter=json:reports/tests.json', '--timeout=100', + '--ignore-timeouts', '--concurrency=3', '--name=name1', '--plain-name=name2', @@ -616,6 +618,7 @@ const List packageTestArgs = [ '--file-reporter=json:reports/tests.json', '--timeout', '100', + '--ignore-timeouts', '--concurrency=3', '--name', 'name1', @@ -1562,6 +1565,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner { String? reporter, String? fileReporter, String? timeout, + bool ignoreTimeouts = false, bool failFast = false, bool runSkipped = false, int? shardIndex, @@ -1611,6 +1615,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner { String? reporter, String? fileReporter, String? timeout, + bool ignoreTimeouts = false, bool failFast = false, bool runSkipped = false, int? shardIndex,