When I use io.mock.every like this: ```every { mo...
# mockk
k
When I use io.mock.every like this:
Copy code
every { mockObj.methodXYZ() } returns "..."
IntelliJ IDEA occasionally puts red lines underneath
every
and on hovering it says "Cannot access class 'io.mockk.MockKStubScope'. Check your module classpath for missing or conflicting dependencies". And it shows "unresolved reference: returns" obviously because that's a method of MockKStubScope which it isn't accessing. This is only a problem in the editor. If I do a "Build" or "Rebuild", it builds successfully (but the red line under
every
still remains). Sometimes, when I invalidate caches and restart, the problem goes away, but not always. My dependency is:
Copy code
<dependency>
    <groupId>io.mockk</groupId>
    <artifactId>mockk</artifactId>
    <version>1.12.0</version>
    <scope>test</scope>
</dependency>
The class MockKStubScope is defined in mockk-dsl-jvm-1.12.0.jar, which is a transitive dependency. Is this a known issue, or am I using mockk incorrectly?
m
you’re using mockk correctly and it looks like an intellij issue rather than an issue with mockk 😞
🙏 1
l
Yep. This happens to me from time to time for random libraries
k
https://youtrack.jetbrains.com/issue/KTIJ-19504 says it's a bug in the Kotlin plugin version 1.5.30 that's fixed in a forthcoming release. Workaround is to downgrade the plugin.