You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a setup where I have one AutoMockable.stencil file that I use as template for 2 configurations. One configuration outputs in a file in the unit tests target, and one in the App target.
I use this to generate mocks for SwiftUI previews and also have them for unit tests.
Another note is, I use 2 // sourcery: AutoMockable annotations:
the standard // sourcery: AutoMockable - used to output in the tests target file
a new // sourcery: AutoMockableApp - used to output in the App target file
I also have some custom flags configured in the .sourcery.yml to be able to differentiate which configuration is run (the unit tests or app) in order to customize the resulting mocks.
Finally, the super-weird part is that some times it works, but if I run sourcery multiple times consecutively, it breaks and doesn't find the annotations in one of the configurations
The AutoMockable.stencil is the same like the template one on this repo, just modified it a bit to not generate CalledCount, etc for the App target mocks.
The text was updated successfully, but these errors were encountered:
alexdmotoc
changed the title
Annotations not parse when running Sourcery with the same template but different output files
Annotations not parsed when running Sourcery with the same template but different output files
Aug 10, 2024
You just need to run sourcery multiple times, one after the other. I tried with --disableCache but it still fails. SomeTypeToBeUsedAsGenericConstraint is not generated anymore, only SomeTypeUsingGenericConstraint
We have sourcery as a pre-build phase (don't ask why, it was there when I found it 😸 ) and since we're working with SwiftUI and Previews, you can imagine sourcery is called quite often when the previews are built.
Hi!
I have a setup where I have one
AutoMockable.stencil
file that I use as template for 2 configurations. One configuration outputs in a file in the unit tests target, and one in the App target.I use this to generate mocks for SwiftUI previews and also have them for unit tests.
Another note is, I use 2
// sourcery: AutoMockable
annotations:// sourcery: AutoMockable
- used to output in the tests target file// sourcery: AutoMockableApp
- used to output in the App target fileI also have some custom flags configured in the
.sourcery.yml
to be able to differentiate which configuration is run (the unit tests or app) in order to customize the resulting mocks.Finally, the super-weird part is that some times it works, but if I run
sourcery
multiple times consecutively, it breaks and doesn't find the annotations in one of the configurationsMy
.sourcery.yml
looks like thisThe
AutoMockable.stencil
is the same like the template one on this repo, just modified it a bit to not generate CalledCount, etc for the App target mocks.Mocked protocol looks like this
Attached photos of the output in the App target
Any ideas what could be the problem?
The text was updated successfully, but these errors were encountered: