Closed sskjames closed 5 months ago
Hi. My configuration is like this and it works.
Cuckoo (2.0.3)
Cuckoofile.toml
[modules.iOSTemplate] <- Name of my project output = "iOSTemplateTests/GeneratedMocks.swift" <- Location of my file imports = [] testableImports = ["iOSTemplate"] <- Name of my project again sources = [ "iOSTemplate/Domain/UseCases/Quote/GetQuotesUseCase.swift", <- My file to mock ]
My script in tests target (Build phases):
if [ $ACTION == "indexbuild" ]; then exit 0 fi
if [ "${ENABLE_PREVIEWS}" = "YES" ]; then exit 0 fi
"${PODS_ROOT}/Cuckoo/run"
I hope this helps!
Thank you @Zeydi for sharing the working configuration.
@sskjames how are you integrating Cuckoo into your project? There may be a case I have missed because the errors printed are kinda weird.
The first one seems to be an undefined version
in the run script while the second is a generator runtime error and the last one I don't even know.
Please try creating a sample project where this problem occurs and sharing it with me, I don't have access to internet for the moment but I'll take a look at it as soon as I can.
Hello @MatyasKriz,
I'm getting the same error. I run the script from CLI. The last working version of cuckoonator is 2.0.2. Above 2.0.2 it doesn't work no matter what I've tried.
My error is: cuckoonator/SwiftSyntax+convenience.swift:44: Fatal error: Cuckoo error: Expected identifier. Please create an issue.
@stzouvaras thanks for the info, it must be an edge case that I'm missing.
I'll have to add the file path where this happens as well so we can track it down and fix it.
Please try again with version 2.0.6, the logging there should be better and allow us to find the issue.
Hi @MatyasKriz,
error now is:
cuckoonator/SwiftSyntax+convenience.swift:49: Fatal error: Cuckoo error: Expected identifier. Please create an issue. SwiftSyntax+convenience.swift:49: Fatal error: Cuckoo error: Expected identifier. Please create an issue.
if it helps, with version 2.0.2, which is working, I get the following working messages:
Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'MainActor' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'MainActor' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'MainActor' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'MainActor' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'MainActor' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'MainActor' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'MainActor' Ignoring unsupported attribute 'Published' Ignoring unsupported attribute 'propertyWrapper' Ignoring unsupported attribute 'MainActor' Ignoring unsupported attribute 'Published'
No, I was tired and forgot to replace the fatalError with throwing an error. ðŸ˜
Thanks for trying it out, version 2.0.7 will work as intended.
Sorry about this, could you please try one more time with 2.0.7? That one should actually print the identifier that's causing the trouble and file path where it occurs.
Also, the "ignoring unsupported attribute" spam has been moved to --verbose
in case anyone wants to read it, but most people probably do not and in hindsight it should've been logged there from the start. 😄
Hi @MatyasKriz
error: Can't parse method parameters '_ value: Any?, forKey: Prefs.Key'.
Prefs.Key is:
public struct Prefs {}
public extension Prefs { enum Key: String { case blabla } }
I see, it's the same thing I fixed for generics a while back. Thank you so much for the error, I'll make sure to add it to the tests in various places and more importantly fix it as soon as I can.
Found out that the problem is actually Any
, it's a keyword, who knew.
I've revamped the identifier matching completely so it's less fragile, it's in release 2.0.8 if you wanna try it.
Found out that the problem is actually
Any
, it's a keyword, who knew.I've revamped the identifier matching completely so it's less fragile, it's in release 2.0.8 if you wanna try it.
Hi @MatyasKriz,
2.0.8 works as expected. Thank you for your effort and support.
Likewise thanks for testing it through this iterative process, @stzouvaras. 🙂
Had been using Cuckoo 1.x for many years now and I'm very thankful for this great library. However, I couldn't get Cuckoo 2.0.3 to work. Upgraded from 1.10.3 to 2.0.3 and used the new Run script which is defined above the Compile Source phase. Defined a minimal Cuckoofile like this:
However, when trying to build the test target, I get the following error:
Have I missed some configuration? Appreciate your help.