(mix test) change default warn_test_pattern and add separate ignore pattern
#14034
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using the default project configuration, mix test would only warn about files ending in
_test.ex. The only mistake this warns about is forgetting thesof.exs. In a work project we noticed (after more than a year) that we had multiple test files that did not match the test pattern, preventing them from running in mix test locally and CI. Because we have many other tests, nobody noticed this. If CI passes, all is good, right?This commit changes the default
warn_test_patternto "*.{ex,exs}", which matches bascially all Elixir files and restricts them with a separatewarn_test_ignore_patternthat can be a more complex regular expression, defaulting to.*_helper.exs, which should be a good default. It also ignores any compiled files, for example test support files, by also looking at the configuredelixirc_paths.For projects with an existing
warn_test_patternconfiguration that want to keep the same behavior, thewarn_test_ignore_patterncan be set to a falsy value, although it would only make a difference if they had any*_helper.exsthey do not want to have ignored, which should be quite rare.