-
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
If specifying a directory, tests in subdirectories should be run too #249
Comments
It's intentionally not recursive, as a good default and simplicity. If you need it to be recursive just specify the appropriate glob pattern. Like: |
Ok. Now if I have a file
But it should look more like
At least while nested groups aren't available (#222) using directories is a good way to organize structure, so the output should be in line with that. The beginning That's why I think allowing to specify a directory with a recursive flag (so it's not the default and not a breaking change) would be useful, because then ava can format the results appropriately. Because using glob patterns ava just receives a list of filenames to test and isn't aware of a 'root'. |
We don't add options lightly and we try very hard to keep AVA simple. You can solve this with a glob pattern. We'll fix the output somehow :) |
A suggestion of how it could look. After seeing all the files passed in with the glob pattern it should strip the leading directories that are all in common. The way if someone passes in a pattern like |
Agreed, that's what I was thinking too. |
I think it should be recursive by default. In my case, I want to mimic my Further, this is how other languages' test systems work and is analogous to those for me, personally - hence my decision to structure my tests like this. As of now, I have to do Then again, I see that's not what's happening anyway. Nested files, to me, should have their file prefixes (in my opinion). Right now it's flat. Not sure if this is because I'm specifying files on the command line, or what. |
@jamestalmage @vdemedes Thoughts on making it recursive by default? I'm warming up to the idea. |
All AVA really needs to do is include the file in question and ignore it if it doesn't import the test function. |
I'd prefer to have it throw an error. We fork for each of those and that is expensive. We automatically ignore files with a
I'm not sure what you mean. Their directory as part of the prefix? Right now we only prefix with the filename (and just the filename) if there is more than one test file. I think it makes sense to prefix directories (find the common base directory of all test files and prefix from there). |
I like this suggestion, we could simplify paths and remove the need for globs. |
Alright. Let's go for this. |
+1 on making AVA recursive by default. It's the behavior I was expecting initially and doesn't force the user to conform to a standard structure. |
@sindresorhus: Do you want it to be recursive by default, or just to display directories up to a common root? |
@ariporad Both |
@sindresorhus: Ok, I'll take care of it. Can you assign this to me (or give me perms to do that if you prefer)? |
@ariporad just submit a pull request :) |
Also, add tests and documentation. Fixes avajs#249.
If I do
ava test
where test is a directory, it only runs the files directly undertest
. But if I had subdirectories under it, those don't get run. I think it should run all tests in that directory recursively. Or at least there should be a command line flag like-r
to get this behavior.The text was updated successfully, but these errors were encountered: