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
The current version of documentation recommends to set the jvmArgs as the jvmArgs
tasks {
test {
jvmArgs("-javaagent:${mockitoAgent.asPath}")
}
}
This is working when only Mockito agent is in use. As soon as another agent is expected (example for code coverage), this will fail as this overrides any previously registered agent. It will also remove all previously set jvmArgs.
To reproduce:
Both from IntelliJ
Run tests requiring Mockito agent coinfigured as documented, it will succeed
Re-run the same test with coverage, test will fail
Fix
The fix is trivial, instead of setting the jvmArgs, we need to add the entry instead.
tasks {
test {
jvmArgs.add("-javaagent:${mockitoAgent.asPath}")
}
}