Test code cannot access internal functions in same module
See original GitHub issueWhile trying to upgrade to Dagger 2.31.2 I noticed that some of my tests failed to compile saying that the functions they were testing were not accessible because they are internal
. After some experimentation I concluded that enableExperimentalClasspathAggregation
was the culprit. If I enable it my tests fail to compile, if I leave it disabled they compile just fine.
I’m assuming this has something to do with how that is implemented and I’m guessing it tweaks kapt
or something like that.
The module in question is an android library module and I’m using the following dagger/kapt options:
kapt {
useBuildCache = true
correctErrorTypes = true
arguments {
arg("dagger.fastInit", "enabled")
arg("dagger.validateTransitiveComponentDependencies", "DISABLED")
}
}
hilt {
enableExperimentalClasspathAggregation = true
}
android {
lintOptions.isCheckReleaseBuilds = false
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Unable to Access Internal Classes from Test Code within ...
Unable to Access Internal Classes from Test Code within Same Module If I have an internal class defined like this in my main...
Read more >How to access and test an internal (non-exports) function in a ...
The rewire module is definitely the answer. Here's my code for accessing an unexported function and testing it using Mocha. application.js:
Read more >Unit Testing Module-Internal Functions
Unit tests are supposed to be for external functions only. Nevertheless, if you have a lot of "internal code", it should be tested...
Read more >Can't access internal functions from test module - JavaScript
Hi there,. Say that I have 2 files: ... I expected this to work, because both functions are defined in the same package....
Read more >2. Maintainability depends on modularity: Stop using ...
Modular code is code which is separated into independent modules. ... to the other module directly via a global name; it might use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can confirm it’s working using a snapshot build off master 👏
I face the same issue with
enableExperimentalClasspathAggregation = true
. It also breaks:app:lintRelease
: