Skip to content

Commit 494855a

Browse files
committed
Clarify tag includes, closes #14664
1 parent 4b48982 commit 494855a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/mix/lib/mix/tasks/test.ex

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ defmodule Mix.Tasks.Test do
276276
277277
After running the command above, you must restart your current console.
278278
279-
## Filters
279+
## Tags and filters
280280
281281
ExUnit provides tags and filtering functionality that allow developers
282282
to select which tests to run. The most common functionality is to exclude
@@ -298,18 +298,19 @@ defmodule Mix.Tasks.Test do
298298
299299
Note that all tests are included by default, so unless they are excluded
300300
first (either in the test helper or via the `--exclude` option) the
301-
`--include` option has no effect.
301+
`--include` option has no effect. The other in which filters are applied
302+
are also consistent: first all exclusions are computed, then the inclusions.
302303
303-
For this reason, Mix also provides an `--only` option that excludes all
304-
tests and includes only the given ones:
304+
For convenience, Mix also provides an `--only` option that excludes all tests
305+
and includes only the given ones:
305306
306307
$ mix test --only external
307308
308309
Which is similar to:
309310
310311
$ mix test --include external --exclude test
311312
312-
It differs in that the test suite will fail if no tests are executed when the `--only` option is used.
313+
However, when the `--only` option is used and no tests run, the test run fails.
313314
314315
In case a single file is being tested, it is possible to pass one or more specific
315316
line numbers to run only those given tests:
@@ -328,8 +329,9 @@ defmodule Mix.Tasks.Test do
328329
329330
$ mix test --exclude test --include line:12 --include line:24 test/some/particular/file_test.exs
330331
331-
If a given line starts a `describe` block, that line filter runs all tests in it.
332-
Otherwise, it runs the closest test on or before the given line number.
332+
If a given line starts a `describe` block, that line filter includes all tests
333+
within the describe. Otherwise, it runs the closest test on or before the given
334+
line number.
333335
334336
## Coverage
335337

0 commit comments

Comments
 (0)