uber / mockolo

Efficient Mock Generator for Swift
Apache License 2.0
813 stars 86 forks source link

Fails silently when destination directory does not exist #189

Closed maiyama18 closed 2 years ago

maiyama18 commented 2 years ago

When the path passed to --destination option has non-existent parent directory, mockolo fails to create mock file but it cannot be read from the log message.

❯ mockolo --sourcedirs Path/To/SourceDir --destination /NonexistentDirectory/Mocks.swift
Start...
["Process input mock files..."]
["Took", 4.1961669921875e-05]
["Process source files and generate an annotated/protocol map..."]
["Took", 0.023231029510498047]
["Resolve inheritance and generate unique entity models..."]
["Took", 0.0008450746536254883]
["Render models with templates..."]
["Took", 0.0002319812774658203]
["Write the mock results and import lines to", "/NonexistentDirectory/Mocks.swift"]
["Took", 0.0001609325408935547]
["TOTAL", 0.024510979652404785]
["#Protocols = 3, #Annotated protocols = 3, #Parent mock classes = 0, #Final mock classes = 3, File LoC = 77"]
["Done. Exiting program."]
Done.

I think it would be less confusing if error message like destination directory /NonexistentDirectory does not exist is shown in this situation.

If it's OK, I'd be happy to create a PR for this. Please close this issue if the current behavior is intentional for some reason.

uhooi commented 2 years ago

I'm not familiar with Mockolo's history, but I would be happy to have you create a PR :)

EspressoCup commented 2 years ago

If it's OK, I'd be happy to create a PR for this. Please close this issue if the current behavior is intentional for some reason.

@maiyama18 sgtm!