-
Notifications
You must be signed in to change notification settings - Fork 33
[FR]: Support adding testonly
to a glob of folders/files with gazelle plugin
#669
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
Comments
Could this not be handled using |
In this case it would treat the mocks as test files I believe and generate a test target for them. I think this may be acceptable. But I would have to do it for every mocks folder right? |
You can just configure it once so mocks have their own "test target". In your root BUILD you can just do:
Then anywhere that glob finds files you'll get the extra target:
|
Is there any documentation on what glob pattern we should use? This glob cannot find the mocks folder in our code base and there is no logging to help debug
|
@shanshanzhu do you have a minimal repro of that problem? I think @jbedard is claiming that no work is needed here. |
I tried to add a preliminary test cases to show the idea. But I'm not sure how to run the test. Basically
|
What is the current behavior?
You can't isolate out a folder and say "for this folder, please give me source targets and add
testonly
to make sure this folder doesn't get used in production". This means we can do build file generation on a folder likemocks
but we have to manually addtestonly
.Describe the feature
We should be able to pass a directive like
#gazelle:treat_as_testonly **/mocks/**
that will generate targets in anymocks
folder found, but addtestonly
to thets_project
target. This prevents anything from mocks being used downstream and ending up in production.The text was updated successfully, but these errors were encountered: