Skip to content

Commit f32c5e9

Browse files
authored
Merge branch 'main' into feat/workspace-license-support
2 parents b8d019f + 04e0847 commit f32c5e9

File tree

9 files changed

+75
-17
lines changed

9 files changed

+75
-17
lines changed

.github/workflows/bump_templates.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: tool/generate_bundles.sh
2424

2525
- name: Create Pull Request
26-
uses: peter-evans/create-pull-request@v8.0.0
26+
uses: peter-evans/create-pull-request@v8.1.0
2727
with:
2828
base: main
2929
labels: bot

.github/workflows/spdx_license_bot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
4848
- name: 📝 Create Pull Request
4949
if: ${{ env.did_change == 'true' }}
50-
uses: peter-evans/create-pull-request@v8.0.0
50+
uses: peter-evans/create-pull-request@v8.1.0
5151
with:
5252
base: main
5353
labels: bot

lib/src/commands/dart/commands/dart_test_command.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class DartTestOptions {
1919
required this.excludeFromCoverage,
2020
required this.randomSeed,
2121
required this.optimizePerformance,
22+
required this.failFast,
2223
required this.forceAnsi,
2324
required this.platform,
2425
required this.rest,
@@ -41,6 +42,7 @@ class DartTestOptions {
4142
? Random().nextInt(4294967295).toString()
4243
: randomOrderingSeed;
4344
final optimizePerformance = argResults['optimization'] as bool;
45+
final failFast = argResults['fail-fast'] as bool;
4446
final forceAnsi = argResults['force-ansi'] as bool?;
4547
final platform = argResults['platform'] as String?;
4648
final reportOn = argResults['report-on'] as String?;
@@ -55,6 +57,7 @@ class DartTestOptions {
5557
excludeFromCoverage: excludeFromCoverage,
5658
randomSeed: randomSeed,
5759
optimizePerformance: optimizePerformance,
60+
failFast: failFast,
5861
forceAnsi: forceAnsi,
5962
platform: platform,
6063
reportOn: reportOn,
@@ -86,6 +89,9 @@ class DartTestOptions {
8689
/// Whether to apply optimizations for test performance.
8790
final bool optimizePerformance;
8891

92+
/// Whether to stop running tests after the first failure.
93+
final bool failFast;
94+
8995
/// Whether to force ansi output. If not specified, it will maintain the
9096
/// default behavior based on stdout and stderr.
9197
final bool? forceAnsi;
@@ -171,7 +177,7 @@ class DartTestCommand extends Command<int> {
171177
'exclude-coverage',
172178
help:
173179
'A glob which will be used to exclude files that match from the '
174-
'coverage.',
180+
"coverage (e.g. '**/*.g.dart').",
175181
)
176182
..addOption(
177183
'exclude-tags',
@@ -188,6 +194,11 @@ class DartTestCommand extends Command<int> {
188194
'The seed to randomize the execution order of test cases '
189195
'within test files.',
190196
)
197+
..addFlag(
198+
'fail-fast',
199+
help: 'Stop running tests after the first failure.',
200+
negatable: false,
201+
)
191202
..addFlag(
192203
'force-ansi',
193204
defaultsTo: null,
@@ -265,6 +276,7 @@ This command should be run from the root of your Dart project.''');
265276
arguments: [
266277
if (options.excludeTags != null) ...['-x', options.excludeTags!],
267278
if (options.tags != null) ...['-t', options.tags!],
279+
if (options.failFast) '--fail-fast',
268280
if (options.platform != null) ...['--platform', options.platform!],
269281
if (options.platform == null) ...['-j', options.concurrency],
270282
...options.rest,

lib/src/commands/test/test.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class FlutterTestOptions {
2020
required this.randomSeed,
2121
required this.optimizePerformance,
2222
required this.updateGoldens,
23+
required this.failFast,
2324
required this.forceAnsi,
2425
required this.dartDefine,
2526
required this.dartDefineFromFile,
@@ -44,6 +45,7 @@ class FlutterTestOptions {
4445
: randomOrderingSeed;
4546
final optimizePerformance = argResults['optimization'] as bool;
4647
final updateGoldens = argResults['update-goldens'] as bool;
48+
final failFast = argResults['fail-fast'] as bool;
4749
final forceAnsi = argResults['force-ansi'] as bool?;
4850
final dartDefine = argResults['dart-define'] as List<String>?;
4951
final dartDefineFromFile =
@@ -61,6 +63,7 @@ class FlutterTestOptions {
6163
randomSeed: randomSeed,
6264
optimizePerformance: optimizePerformance,
6365
updateGoldens: updateGoldens,
66+
failFast: failFast,
6467
forceAnsi: forceAnsi,
6568
dartDefine: dartDefine,
6669
dartDefineFromFile: dartDefineFromFile,
@@ -97,6 +100,9 @@ class FlutterTestOptions {
97100
/// the golden files.
98101
final bool updateGoldens;
99102

103+
/// Whether to stop running tests after the first failure.
104+
final bool failFast;
105+
100106
/// Whether to force ansi output. If not specified, it will maintain the
101107
/// default behavior based on stdout and stderr.
102108
final bool? forceAnsi;
@@ -185,7 +191,7 @@ class TestCommand extends Command<int> {
185191
'exclude-coverage',
186192
help:
187193
'A glob which will be used to exclude files that match from the '
188-
'coverage.',
194+
"coverage (e.g. '**/*.g.dart').",
189195
)
190196
..addOption(
191197
'exclude-tags',
@@ -209,6 +215,11 @@ class TestCommand extends Command<int> {
209215
'should update the golden files.',
210216
negatable: false,
211217
)
218+
..addFlag(
219+
'fail-fast',
220+
help: 'Stop running tests after the first failure.',
221+
negatable: false,
222+
)
212223
..addFlag(
213224
'force-ansi',
214225
defaultsTo: null,
@@ -306,6 +317,7 @@ This command should be run from the root of your Flutter project.''');
306317
if (options.excludeTags != null) ...['-x', options.excludeTags!],
307318
if (options.tags != null) ...['-t', options.tags!],
308319
if (options.updateGoldens) '--update-goldens',
320+
if (options.failFast) '--fail-fast',
309321
if (options.platform != null) ...['--platform', options.platform!],
310322
if (options.dartDefine != null)
311323
for (final value in options.dartDefine!) '--dart-define=$value',

site/docs/commands/test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ very_good test [arguments]
2222
-j, --concurrency The number of concurrent test suites run.
2323
(defaults to "4")
2424
-t, --tags Run only tests associated with the specified tags.
25-
--exclude-coverage A glob which will be used to exclude files that match from the coverage.
25+
--exclude-coverage A glob which will be used to exclude files that match from the coverage (e.g. '**/*.g.dart').
2626
-x, --exclude-tags Run only tests that do not have the specified tags.
2727
--min-coverage Whether to enforce a minimum coverage percentage.
2828
--test-randomize-ordering-seed The seed to randomize the execution order of test cases within test files.

site/package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"react-dom": "^19.2.3"
2828
},
2929
"devDependencies": {
30-
"@babel/eslint-parser": "^7.28.5",
30+
"@babel/eslint-parser": "^7.28.6",
3131
"@docusaurus/eslint-plugin": "^3.9.2",
3232
"@docusaurus/module-type-aliases": "^3.9.2",
3333
"@docusaurus/tsconfig": "3.9.2",
@@ -37,7 +37,7 @@
3737
"eslint-plugin-jest": "^29.12.1",
3838
"globals": "^17.0.0",
3939
"jest": "^30.2.0",
40-
"prettier": "^3.7.4",
40+
"prettier": "^3.8.0",
4141
"typescript": "^5.9.3"
4242
},
4343
"browserslist": {

test/src/commands/dart/commands/dart_test_test.dart

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ const expectedTestUsage = [
3434
'-j, --concurrency The number of concurrent test suites run. Automatically set to 1 when --platform is specified.\n'
3535
' (defaults to "4")\n'
3636
'-t, --tags Run only tests associated with the specified tags.\n'
37-
' --exclude-coverage A glob which will be used to exclude files that match from the coverage.\n'
37+
" --exclude-coverage A glob which will be used to exclude files that match from the coverage (e.g. '**/*.g.dart').\n"
3838
'-x, --exclude-tags Run only tests that do not have the specified tags.\n'
3939
' --min-coverage Whether to enforce a minimum coverage percentage.\n'
4040
' --test-randomize-ordering-seed The seed to randomize the execution order of test cases within test files.\n'
41+
' --fail-fast Stop running tests after the first failure.\n'
4142
' --force-ansi Whether to force ansi output. If not specified, it will maintain the default behavior based on stdout and stderr.\n'
4243
' --report-on=<lib/> An optional file path to report coverage information to. This should be a path relative to the current working directory.\n'
4344
' --platform=<chrome|vm> The platform to run tests on. \n'
@@ -108,6 +109,7 @@ void main() {
108109
when<dynamic>(() => argResults['concurrency']).thenReturn(concurrency);
109110
when<dynamic>(() => argResults['recursive']).thenReturn(false);
110111
when<dynamic>(() => argResults['coverage']).thenReturn(false);
112+
when<dynamic>(() => argResults['fail-fast']).thenReturn(false);
111113
when<dynamic>(() => argResults['optimization']).thenReturn(true);
112114
when<dynamic>(() => argResults['platform']).thenReturn(null);
113115
when(() => argResults.rest).thenReturn([]);
@@ -256,6 +258,21 @@ void main() {
256258
).called(1);
257259
});
258260

261+
test('completes normally --fail-fast', () async {
262+
when<dynamic>(() => argResults['fail-fast']).thenReturn(true);
263+
final result = await testCommand.run();
264+
expect(result, equals(ExitCode.success.code));
265+
verify(
266+
() => dartTest(
267+
optimizePerformance: true,
268+
arguments: ['--fail-fast', ...defaultArguments],
269+
logger: logger,
270+
stdout: logger.write,
271+
stderr: logger.err,
272+
),
273+
).called(1);
274+
});
275+
259276
test('completes normally --platform chrome', () async {
260277
when<dynamic>(() => argResults['platform']).thenReturn('chrome');
261278
final result = await testCommand.run();

test/src/commands/test/test_test.dart

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ const expectedTestUsage = [
3434
'-j, --concurrency The number of concurrent test suites run. Automatically set to 1 when --platform is specified.\n'
3535
' (defaults to "4")\n'
3636
'-t, --tags Run only tests associated with the specified tags.\n'
37-
' --exclude-coverage A glob which will be used to exclude files that match from the coverage.\n'
37+
" --exclude-coverage A glob which will be used to exclude files that match from the coverage (e.g. '**/*.g.dart').\n"
3838
'-x, --exclude-tags Run only tests that do not have the specified tags.\n'
3939
' --min-coverage Whether to enforce a minimum coverage percentage.\n'
4040
' --test-randomize-ordering-seed The seed to randomize the execution order of test cases within test files.\n'
4141
' --update-goldens Whether "matchesGoldenFile()" calls within your test methods should update the golden files.\n'
42+
' --fail-fast Stop running tests after the first failure.\n'
4243
' --force-ansi Whether to force ansi output. If not specified, it will maintain the default behavior based on stdout and stderr.\n'
4344
' --dart-define=<foo=bar> Additional key-value pairs that will be available as constants from the String.fromEnvironment, bool.fromEnvironment, int.fromEnvironment, and double.fromEnvironment constructors. Multiple defines can be passed by repeating "--dart-define" multiple times.\n'
4445
' --dart-define-from-file=<use-define-config.json|.env> The path of a .json or .env file containing key-value pairs that will be available as environment variables. These can be accessed using the String.fromEnvironment, bool.fromEnvironment, and int.fromEnvironment constructors. Multiple defines can be passed by repeating "--dart-define-from-file" multiple times. Entries from "--dart-define" with identical keys take precedence over entries from these files.\n'
@@ -110,6 +111,7 @@ void main() {
110111
when<dynamic>(() => argResults['recursive']).thenReturn(false);
111112
when<dynamic>(() => argResults['coverage']).thenReturn(false);
112113
when<dynamic>(() => argResults['update-goldens']).thenReturn(false);
114+
when<dynamic>(() => argResults['fail-fast']).thenReturn(false);
113115
when<dynamic>(() => argResults['optimization']).thenReturn(true);
114116
when<dynamic>(() => argResults['platform']).thenReturn(null);
115117
when(() => argResults.rest).thenReturn([]);
@@ -272,6 +274,21 @@ void main() {
272274
).called(1);
273275
});
274276

277+
test('completes normally --fail-fast', () async {
278+
when<dynamic>(() => argResults['fail-fast']).thenReturn(true);
279+
final result = await testCommand.run();
280+
expect(result, equals(ExitCode.success.code));
281+
verify(
282+
() => flutterTest(
283+
optimizePerformance: true,
284+
arguments: ['--fail-fast', ...defaultArguments],
285+
logger: logger,
286+
stdout: logger.write,
287+
stderr: logger.err,
288+
),
289+
).called(1);
290+
});
291+
275292
test('completes normally --platform chrome', () async {
276293
when<dynamic>(() => argResults['platform']).thenReturn('chrome');
277294
final result = await testCommand.run();

0 commit comments

Comments
 (0)