Skip to content
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

Change directory for generated mocks #545

Closed
SharbelOkzan opened this issue Jul 18, 2022 · 7 comments · Fixed by #685
Closed

Change directory for generated mocks #545

SharbelOkzan opened this issue Jul 18, 2022 · 7 comments · Fixed by #685
Labels
contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@SharbelOkzan
Copy link

If I'm not missing anything, there's currently no way to change the default location of the generated files using @generateMocks .

For example, in our project, we want all generated *.mock.dart files to be in a single package instead of spreading them among the test folders.

I believe many will also appreciate this feature, especially since it's common practice to store all mocks in a single folder in other frameworks.

Please correct me if this configuration option exists and I didn't find it.

@srawlins
Copy link
Member

Thanks for filing the request; this feature does not exist today.

@natebosch it looks like we have the ability to hand-craft an AssetId for the BuildStep's output. Do you know if any other builder has added a configuration option like this?

@natebosch
Copy link
Member

natebosch commented Aug 3, 2022

Here is a nice writeup the author of the feature wrote about using the new build extension syntax which allows directory moves: https://simonbinder.eu/posts/build_directory_moves/

@hurrba
Copy link

hurrba commented Nov 11, 2022

any updates on this?

@srawlins
Copy link
Member

No update

@jmandawg
Copy link

+1 this should be a feature.

@yanok yanok added type-enhancement A request for a change that isn't a bug P3 A lower priority bug or feature request contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) labels Jun 30, 2023
@yanok
Copy link
Contributor

yanok commented Jun 30, 2023

to set expectations: we are not going to work in this anytime soon. Contributions are welcome.

@LuisDuarte1
Copy link
Contributor

LuisDuarte1 commented Aug 10, 2023

I'm working on this, please refer to my PR, for further comments on the issue.

I find it useful, because it gets a bit confusing to have a lot of .mocks.dart files in the same directory and you don't have to look at them at all, for the most part. So having the option to change directory through build_extensions is very useful imo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants