Add optional restricted mock system property#1454
Conversation
|
Looks good to me. Would you be to add a mention of this in the docs here? |
| throwExceptionOnBadMock = loadThrowExceptionSetting(properties) || | ||
| loadThrowExceptionSystemProperty() |
There was a problem hiding this comment.
I don't think || is the right combiner here, it should be system ?: setting.
Suppose the properties file contains:
mockk.throwExceptionOnBadMock=true
and you run
gradlew -Pmockk.throwExceptionOnBadMock=false
what would you expect?
I would run that command explicitly because "I just want to see the tests run without this check".
There was a problem hiding this comment.
Thank you for the feedback! I will look into applying this suggestion once I am home!
Thank you for the feedback! I will do that once I get home:) |
|
@Raibaz @TWiStErRob Added MD and addressed comment, thank you! |
Overview
Hello!
Currently, we can enable restricted mocking via
mockk.propertiesfile. One thing that would be really helpful for large projects with multi-modules is the ability to have restricted mocking per class or even per gradle command via terminal. This would make it easier to tackle modules one-by-one, for example:./gradlew -Pmockk.throwExceptionOnBadMock=true feature:your-module:testI've added a couple of tests to demonstrate this works with current config as well.
@Raibaz, what are your thoughts on this?