-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve file and helper selection #2103
Conversation
I'm thinking it's actually quite confusing that Any helper matched as a test file will still be treated as a helper. For now that's just files starting with an underscore. But before we can ship this as a 2.0 we need to make it possible to specify glob patterns for helper files. These then can be tuned to user's project setup. Any test file that also matches the helper patterns will be considered a helper, not a test file. If you disable the Babel pipeline, AVA won't need to find helper files, just exclude test files that are helpers. With this PR, test files are still found based on the configured extensions. It just takes a lot less code. You can specify solely exclusion patterns, which will be applied together with the default patterns. Overriding the default exclusion patterns is no longer possible. If this becomes a problem we can introduce a setting to customize the default exclusion patterns. My plan is to get this working and then ship it as a 2.0 beta. |
With regards to our ESLint plugin, my idea's to expose |
I was hoping for v2 we could drop the concept of helpers (which users generally find surprising and awkward) in favor just transpiling everything. |
That's not going to happen in the next say two weeks. Even then, presumably we need the ability to compile tests differently from sources, and this helper work will still be necessary. Hopefully with these changes helpers are easier to understand though. It'll be test files that start with an underscore. Everything else will be opt-in. |
9be5388
to
5823d36
Compare
* Require globs to match files, not directories * files and sources must be an array of one or more patterns, not a string * Only accept files via the CLI, not globs or directories * Upgrade globby * At this stage, only test files starting with _ are treated as helpers. Helper globs should be made configurable. * It's no longer possible to override an exclusion pattern. We may reintroduce this at a later stage
1f18539
to
3647321
Compare
Does it? |
No, it's a Chokidar limitation. |
I've run out of time today and can't finish this PR:
Supportfiled Supporthelpers
globs (see Ava does not transpile helpers! #1319)helpers
globs #2105Ensure our linter plugin recognizes the new syntaxfiled Support new file and helper selection eslint-plugin-ava#238"Global" excludes which ensures globs are excluded by the watcher toofiled Allow global exclusion patterns to be configured #2106Here's a quick summary of changes. I can expand on rationale later:
files
andsources
must be an array of one or more patterns, not a string_
are treated as helpers.Helper globs should be made configurable.
reintroduce this at a later stage
Fixes #1228
Fixes #909
Fixes #1418
Fixes #1793
Fixes #1501
Fixes #736
Fixes #1540
Fixes #1288
Fixes #1173
Fixes #2085