Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/src/commands/dart/commands/dart_test_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ class DartTestCommand extends Command<int> {
'optimization',
defaultsTo: true,
help:
'Whether to apply optimizations for test performance. '
'Automatically disabled when --platform is specified.',
'Whether to apply optimizations for test performance.\n'
'Automatically disabled when --platform is specified.\n'
'Add the `skip_very_good_optimization` tag to specific test files '
'to disable them individually.',
)
..addOption(
'concurrency',
Expand Down
6 changes: 4 additions & 2 deletions lib/src/commands/test/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,10 @@ class TestCommand extends Command<int> {
'optimization',
defaultsTo: true,
help:
'Whether to apply optimizations for test performance. '
'Automatically disabled when --platform is specified.',
'Whether to apply optimizations for test performance.\n'
'Automatically disabled when --platform is specified.\n'
'Add the `skip_very_good_optimization` tag to specific test files '
'to disable them individually.',
)
..addOption(
'concurrency',
Expand Down
15 changes: 14 additions & 1 deletion site/docs/commands/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ very_good test [arguments]
--coverage Whether to collect coverage information.
-r, --recursive Run tests recursively for all nested packages.
--[no-]optimization Whether to apply optimizations for test performance.
Automatically disabled when --platform is specified.
Add the `skip_very_good_optimization` tag to specific test files to disable them individually.
(defaults to on)
-j, --concurrency The number of concurrent test suites run.
(defaults to "4")
Expand Down Expand Up @@ -60,4 +62,15 @@ Golden tests are tests that compare the output of a test to a "golden" file. If

[Very Good CLI](https://cli.vgv.dev/) supports golden tests out of the box, with and without a custom [`goldenFileComparator`](https://api.flutter.dev/flutter/flutter_test/goldenFileComparator.html). This means that **no change is required** to your test code to run them with `very_good test`.

:::info For an example on specifying a custom [`GoldenFileComparator`](https://api.flutter.dev/flutter/flutter_test/GoldenFileComparator-class.html) that accepts a certain amount of difference (toleration threshold), refer to the [`goldenFileComparator` Flutter documentation](https://api.flutter.dev/flutter/flutter_test/goldenFileComparator.html). :::
:::info For an example on specifying a custom [`GoldenFileComparator`](https://api.flutter.dev/flutter/flutter_test/GoldenFileComparator-class.html) that accepts a certain amount of difference (toleration threshold), refer to the [`goldenFileComparator` Flutter documentation](https://api.flutter.dev/flutter/flutter_test/goldenFileComparator.html).
:::

### Skip optimization for specific tests

By default, all tests run with optimizations enabled; use the `--no-optimization` flag to disable globally, or add the `skip_very_good_optimization` tag to specific test files to disable them individually.

```js
@Tags(['skip_very_good_optimization'])

import 'package:test/test.dart';
```
4 changes: 3 additions & 1 deletion test/src/commands/dart/commands/dart_test_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const expectedTestUsage = [
'-h, --help Print this usage information.\n'
' --coverage Whether to collect coverage information.\n'
'-r, --recursive Run tests recursively for all nested packages.\n'
' --[no-]optimization Whether to apply optimizations for test performance. Automatically disabled when --platform is specified.\n'
' --[no-]optimization Whether to apply optimizations for test performance.\n'
' Automatically disabled when --platform is specified.\n'
' Add the `skip_very_good_optimization` tag to specific test files to disable them individually.\n'
' (defaults to on)\n'
'-j, --concurrency The number of concurrent test suites run. Automatically set to 1 when --platform is specified.\n'
' (defaults to "4")\n'
Expand Down
4 changes: 3 additions & 1 deletion test/src/commands/test/test_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const expectedTestUsage = [
'-h, --help Print this usage information.\n'
' --coverage Whether to collect coverage information.\n'
'-r, --recursive Run tests recursively for all nested packages.\n'
' --[no-]optimization Whether to apply optimizations for test performance. Automatically disabled when --platform is specified.\n'
' --[no-]optimization Whether to apply optimizations for test performance.\n'
' Automatically disabled when --platform is specified.\n'
' Add the `skip_very_good_optimization` tag to specific test files to disable them individually.\n'
' (defaults to on)\n'
'-j, --concurrency The number of concurrent test suites run. Automatically set to 1 when --platform is specified.\n'
' (defaults to "4")\n'
Expand Down