@@ -276,7 +276,7 @@ defmodule Mix.Tasks.Test do
276
276
277
277
After running the command above, you must restart your current console.
278
278
279
- ## Filters
279
+ ## Tags and filters
280
280
281
281
ExUnit provides tags and filtering functionality that allow developers
282
282
to select which tests to run. The most common functionality is to exclude
@@ -298,18 +298,19 @@ defmodule Mix.Tasks.Test do
298
298
299
299
Note that all tests are included by default, so unless they are excluded
300
300
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.
302
303
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:
305
306
306
307
$ mix test --only external
307
308
308
309
Which is similar to:
309
310
310
311
$ mix test --include external --exclude test
311
312
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 .
313
314
314
315
In case a single file is being tested, it is possible to pass one or more specific
315
316
line numbers to run only those given tests:
@@ -328,8 +329,9 @@ defmodule Mix.Tasks.Test do
328
329
329
330
$ mix test --exclude test --include line:12 --include line:24 test/some/particular/file_test.exs
330
331
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.
333
335
334
336
## Coverage
335
337
0 commit comments