-
Notifications
You must be signed in to change notification settings - Fork 5
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
Exclusive assert for files? #11
Comments
That could be a new assertion method. What's the use case? |
My team uses a yeoman generator that pulls in files from other repositories, as a way of managing those parts of the project separately. E.g. we can update the default sass for the generator without updating the root code of the actual generator. Every time I make changes, I need to update the tests that make sure all the files were put in the right place. However, I am human, so sometimes I forget to add new files to the asserts. So the tests pass but I'm not actually accounting for the files. It's weird now that I'm thinking about it, but I think it could be useful for other purposes, like detecting unwanted files or file-copy mistakes. |
This could be possible with the already existing api if glob was used instead of |
@eddiemonge sorry for the "from the grave" revival of this thread, but I just wanted to be sure of what I'm gathering from your response. Are you saying that my use-case is already possible using existing functions, or are you just remarking that it would be possible to implement? |
I was remarking on the implementation. At the time (probably currently as well), file checks were done using |
Forget what I said about glob, you would have to know what you don't want to see, at which point you would probably use noFile. What would you expect the API for this to look like? I am thinking it might be too complex.
|
I'd like to chime in on this and say that I have a similar use-case to @nessthehero. I'm also pulling in files from different repositories. I'd also add that some of the repos that my generator pulls in have files that need to be included elsewhere, but not in the generator. If there are more than a few of these, using I think it'd be much simpler to maintain if I could stick to specifying only the positive assertions, and have the tests fail if additional, unwanted files are present. As far as the API, I think it would make more sense to have the directory come first, and the files array come second: Edit:
|
Is there a way to do an assert.file() but check if only the files I specify are in the directory?
As in, if any files I don't mention exist, fail the test.
The text was updated successfully, but these errors were encountered: