Comments (8)
Interesting! onDecomposeError = null
seems like a good way to disable this.
For now I've just moved over to using Android unit tests instead. We were only really using the JVM target for testing anyway, so this feels like the best target to test on anyway.
from decompose.
Thanks for the question. Which platform is this?
from decompose.
JVM, but it doesn’t really matter what platform is used as the tests won’t be using the platform Main dispatcher (on purpose).
from decompose.
I will check, thanks.
from decompose.
I think I could add an API to disable main thread checks. Though this should be only happening on JVM/Desktop targets with extensions-compose-jetbrains
module added as a dependency.
On iOS tests are running on the main thread, so as long as you are using only UnconfinedTestDispatcher
- it should work.
On Android with JUnit - the checks are disabled because Looper
is unavailable. Only instrumented tests may be affected, but I would prefer using real dispatchers with instrumented/integration tests.
from decompose.
I think the reason I didn't catch this earlier in the TodoApp sample is because it has a separate compose-ui
module for Compose UI, and all components with their tests are in separate modules without extensions-compose-jetbrains
. For the UI we could write simple screenshot tests, but this is another story.
Thanks for raising!
from decompose.
Btw, I have just realised that you can disable throwing this error as follows:
import com.arkivanov.decompose.errorhandler.onDecomposeError
@Before
fun before {
onDecomposeError = null
}
WDYT? It might be still useful to have a dedicated API for disabling main thread checks.
from decompose.
It appears that those exceptions are just logs, they do not fail tests. As mentioned in the docs, the navigation is thread safe, but it's advised to navigate only on the main thread. There are checks that print error logs when access on a non-main thread is detected.
As suggested, we can use onDecomposeError = {}
to disable error logs in tests. This can also be used to hook to an analytics/telemetry logging system.
Closing this for now. Feel free to reopen if there are any questions or concerns.
from decompose.
Related Issues (20)
- Expand the documentation on why do we need components HOT 1
- `LifecycleController` does not consider `resume`/`pause` events. HOT 1
- Consider adding an overload of `predictiveBackAnimation` that has a selector lambda for **both** animation and fallback animation HOT 1
- Describe creating custom navigation models in the docs HOT 1
- How to use StateValue in SwiftUI Textfield HOT 2
- When the app is closed then the subscribeAsState() doesn't work HOT 12
- Print configurations when the uniqueness violation is detected HOT 1
- Accessing ViewModel inside component {Question}
- Где посмотреть на реализацию CustomNavigationComponentChildren HOT 1
- Consider adding some sort of integration to allow easier use of shared element transitions between screens. HOT 7
- Import and open sample project HOT 4
- Can not find the version for installation?
- Support new Compose Multiplatform Lifecycle (and maybe ViewModel) HOT 2
- Update samples and templates HOT 1
- Helpful tip for childSlot HOT 6
- Some Problem in decompose = "3.0.0" and decompose-router = "0.5.1", kotlin = 2.0.0-RC3 HOT 2
- Add StackNavigator#popToFirst extension
- Update dependencies HOT 2
- NotOnMainThreadException false-positive HOT 1
- Improve docs for StateKeeper and InstanceKeeper
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from decompose.