Skip to content

Check parent directory name #51

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

Closed
armandabric opened this issue Mar 24, 2016 · 4 comments · Fixed by #56
Closed

Check parent directory name #51

armandabric opened this issue Mar 24, 2016 · 4 comments · Fixed by #56

Comments

@armandabric
Copy link

In a rule check that we do not create a test files (a file containing import test from 'ava';?) in a path that is not in an ignored path like fixtures or helpers.

  • test/units/foo/myTestFile.js should not trigger an error
  • test/units/foo/helpers/myHelper.js should not trigger an error
  • test/units/foo/helpers/myTestFile.js should trigger an error
@jfmengels
Copy link
Contributor

Sounds like a good idea to me 👍.

Would be nice to actually do that for all files that are not in the AVA glob path, be it the default or a custom one.
For instance, I often use ava "src/**/*.test.js". If I instead indicate it as a param of the rule, or even better in the AVA config in the package.json file (is that something that is supported already? and could the rule get access to that info?), then it would be nice if the ESLint rule caught the fact that some file would not be run.

Does anyone know whether helpers and fixtures are ignored even when defining a custom glob path?

@sindresorhus
Copy link
Member

Does anyone know whether helpers and fixtures are ignored even when defining a custom glob path?

They are.

@jamestalmage
Copy link
Contributor

But you can import 'ava' in a helper if your helper helps you create tests. I have seen that pattern used, and I don't think there is anything wrong with that.

I guess in those situations you could just turn off the rule.

@armandabric
Copy link
Author

In that case you import all AVA our only some part ?

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

Successfully merging a pull request may close this issue.

4 participants