-
-
Notifications
You must be signed in to change notification settings - Fork 766
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
Inconsistent behaviour with --pattern
and specifying which files to test
#2897
Comments
So a couple of things, firstly you've made an assumption that the pattern applies to the working directory but it does not, it applies to the configured default directory which is
To change the behaviour of Now |
For future readers, I was in a similar situation as @imran-iq since my team is introducing Packwerk into our monolith.
And then a bunch of $LOAD_PATH.push __dir__ With this changes, everything works as expected:
This won't probably work for EVERY setup, but I hope this will be useful if you're trying to achieve something similar! |
Subject of the issue
If the default pattern is provided (by omitting
--pattern
or passing it in with its default value--pattern '**{,/*/**}/*_spec.rb'
)we are able to filter which tests to run by providing a file via invocation and only that files tests will run
If we change the pattern to something other than default, we lose that behaviour
There is also another issue where the default glob does not behave as expected
In that link all 3 tests files should match, but when rspec is invoked only tests in the spec directory
Some files are not included to be run (in this case under the engine dir)
Your environment
Steps to reproduce
The files have the following content:
rspec --pattern '**{,/*/**}/*_spec.rb' -f d
rspec --pattern '**{,/*/**}/*_spec.rb' -f d spec/model/model_spec.rb
rspec --pattern '**{,/*/**}/*_spec.rb' -f d engine/test/spec/model/model_spec.rb
rspec --pattern '*/**/*_spec.rb' -f d spec/model/model_spec.rb
Expected behavior
spec/model/model_spec.rb
onlyengine/test/spec/model/model_spec.rb
onlyspec/model/model_spec.rb
onlyActual behavior
spec/
spec/model/model_spec.rb
(expected)engine/test/spec/model/model_spec.rb
(expected)The text was updated successfully, but these errors were encountered: