Skip to content

Commit b6da777

Browse files
authored
docs: update docs for skip_very_good_optimization tag (#1386)
* doc: update docs for skip_very_good_optimization tag * fix: format * fix: tests * fix: md docs
1 parent eedf947 commit b6da777

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,10 @@ class DartTestCommand extends Command<int> {
149149
'optimization',
150150
defaultsTo: true,
151151
help:
152-
'Whether to apply optimizations for test performance. '
153-
'Automatically disabled when --platform is specified.',
152+
'Whether to apply optimizations for test performance.\n'
153+
'Automatically disabled when --platform is specified.\n'
154+
'Add the `skip_very_good_optimization` tag to specific test files '
155+
'to disable them individually.',
154156
)
155157
..addOption(
156158
'concurrency',

lib/src/commands/test/test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ class TestCommand extends Command<int> {
163163
'optimization',
164164
defaultsTo: true,
165165
help:
166-
'Whether to apply optimizations for test performance. '
167-
'Automatically disabled when --platform is specified.',
166+
'Whether to apply optimizations for test performance.\n'
167+
'Automatically disabled when --platform is specified.\n'
168+
'Add the `skip_very_good_optimization` tag to specific test files '
169+
'to disable them individually.',
168170
)
169171
..addOption(
170172
'concurrency',

site/docs/commands/test.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ very_good test [arguments]
1616
--coverage Whether to collect coverage information.
1717
-r, --recursive Run tests recursively for all nested packages.
1818
--[no-]optimization Whether to apply optimizations for test performance.
19+
Automatically disabled when --platform is specified.
20+
Add the `skip_very_good_optimization` tag to specific test files to disable them individually.
1921
(defaults to on)
2022
-j, --concurrency The number of concurrent test suites run.
2123
(defaults to "4")
@@ -60,4 +62,15 @@ Golden tests are tests that compare the output of a test to a "golden" file. If
6062

6163
[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`.
6264

63-
:::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). :::
65+
:::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).
66+
:::
67+
68+
### Skip optimization for specific tests
69+
70+
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.
71+
72+
```js
73+
@Tags(['skip_very_good_optimization'])
74+
75+
import 'package:test/test.dart';
76+
```

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ const expectedTestUsage = [
2727
'-h, --help Print this usage information.\n'
2828
' --coverage Whether to collect coverage information.\n'
2929
'-r, --recursive Run tests recursively for all nested packages.\n'
30-
' --[no-]optimization Whether to apply optimizations for test performance. Automatically disabled when --platform is specified.\n'
30+
' --[no-]optimization Whether to apply optimizations for test performance.\n'
31+
' Automatically disabled when --platform is specified.\n'
32+
' Add the `skip_very_good_optimization` tag to specific test files to disable them individually.\n'
3133
' (defaults to on)\n'
3234
'-j, --concurrency The number of concurrent test suites run. Automatically set to 1 when --platform is specified.\n'
3335
' (defaults to "4")\n'

test/src/commands/test/test_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ const expectedTestUsage = [
2727
'-h, --help Print this usage information.\n'
2828
' --coverage Whether to collect coverage information.\n'
2929
'-r, --recursive Run tests recursively for all nested packages.\n'
30-
' --[no-]optimization Whether to apply optimizations for test performance. Automatically disabled when --platform is specified.\n'
30+
' --[no-]optimization Whether to apply optimizations for test performance.\n'
31+
' Automatically disabled when --platform is specified.\n'
32+
' Add the `skip_very_good_optimization` tag to specific test files to disable them individually.\n'
3133
' (defaults to on)\n'
3234
'-j, --concurrency The number of concurrent test suites run. Automatically set to 1 when --platform is specified.\n'
3335
' (defaults to "4")\n'

0 commit comments

Comments
 (0)