Skip to content

Commit 0b306dd

Browse files
authored
Document behavior of explicit file path args (#2011)
Avoid some confusion around globbing in the shell and having non `_test.dart` files get run as tests.
1 parent 1d65501 commit 0b306dd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pkgs/test/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,14 @@ It's also possible to run a test on the Dart VM only by invoking it using `dart
136136
path/to/test.dart`, but this doesn't load the full test runner and will be
137137
missing some features.
138138

139-
The test runner considers any file that ends with `_test.dart` to be a test
140-
file. If you don't pass any paths, it will run all the test files in your
141-
`test/` directory, making it easy to test your entire application at once.
139+
The test runner accepts one or more path arguments. If there are no path
140+
arguments the runner defaults to running tests under the `test/` directory. When
141+
running for `test/` or any other directory, the runner will recursively search
142+
the directory for files that match the test name pattern `*_test.dart`. The
143+
pattern can be overridden in `dart_test.yaml`. When a path argument is a file
144+
instead of a directory it will be run as a test, regardless of the file name.
145+
Arguments which use shell globbing should avoid including non-test files in the
146+
path argument.
142147

143148
You can select specific tests cases to run by name using `dart test -n "test
144149
name"`. The string is interpreted as a regular expression, and only tests whose

0 commit comments

Comments
 (0)