Skip to content
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

Expose files dirs seperately #1540

Closed
OmgImAlexis opened this issue Oct 2, 2017 · 2 comments · Fixed by #2103
Closed

Expose files dirs seperately #1540

OmgImAlexis opened this issue Oct 2, 2017 · 2 comments · Fixed by #2103
Labels

Comments

@OmgImAlexis
Copy link

Currently apart from passing in my own files list there doesn't seem to be any way to set the helper's directory apart from overriding the whole files array. I'd like to suggest adding a way to change each of the arrays that makes up thefiles option.

This would include defaultExcludePatterns, defaultIncludePatterns and defaultHelperPatterns . My idea would be to use an object for files which has the fieldsexcludes, includes and helpers.

ava/lib/ava-files.js

Lines 76 to 95 in 87eef84

const defaultExcludePatterns = () => [
'!**/node_modules/**',
'!**/fixtures/**',
'!**/helpers/**'
];
const defaultIncludePatterns = () => [
'test.js',
'test-*.js',
'test',
'**/__tests__',
'**/*.test.js'
];
const defaultHelperPatterns = () => [
'**/__tests__/helpers/**/*.js',
'**/__tests__/**/_*.js',
'**/test/helpers/**/*.js',
'**/test/**/_*.js'
];

The reason I'm suggesting this is I want to use __helpers__ for my helper directory as I currently have a helpers directory for a test with my helpers. To add that I'd need to replace the whole files array instead of just doing something like { files: { helpers: ['**/__helpers'] } }.

@sindresorhus
Copy link
Member

Adding more options is rarely a good solution. Maybe we should just use __helpers__ for helpers if you use the naming convention __tests__ for tests, like we do with snapshots.

@novemberborn novemberborn added this to the 1.0 milestone Oct 10, 2017
@novemberborn
Copy link
Member

I've been collecting these issues under the globbing label. I haven't quite summarized the solution, but I actually do think we should support separate helper patterns.

I also like the idea of supporting __helpers__.

I should have more time to work on AVA soon, and this is one of the areas I'd like to tackle. So stay tuned (but not too tuned, can't make any promises 😉 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants