-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
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}")
}
}
Tested with Grade 8.12 and Mockito 5.15.2
See
* jvmArgs("-javaagent:${mockitoAgent.asPath}") |
bric3
Metadata
Metadata
Assignees
Labels
No labels