Joffrey
03/16/2020, 9:43 AMassertFailsWith
?
When using it in a multiplatform project, I can consistently reproduce an issue on the JS platform (everything is fine on JVM).
When I use assertFailsWith(SomeException::class)
everything works as expected (the exception is thrown, the test pass). When I use assertFailsWith<SomeException>
variant, the test fails as if no exception was thrown by the block.
Only a couple of my tests work properly no matter the form used, but all the others fail consistently with the 2nd form and succeed with the 1st form, and I have no idea how this is possible, both are inline functions calling the same 3rd function… I really don’t get it.oroutinesInternalError{message_q7r8iu$_0: 'Fatal exception in coroutines machinery for CancellableContinuation(DispatchedContinuation[WindowDispatcher@1, [object Object]]){CancelledContinuation[JobCancellationException: Parent job is Cancelling; job=TimeoutCoroutine(timeMillis=1000){Cancelled}@2]}@3. Please read KDoc to 'handleFatalException' method and report this incident to maintainers', cause_us9j0c$_0: ClassCastException{message_8yp7un$_0: 'Illegal cast', cause_th0jdv$_0: null, name: 'ClassCastException'}, name: 'CoroutinesInternalError'
CoroutinesInternalError: Fatal exception in coroutines machinery for CancellableContinuation(DispatchedContinuation[NodeDispatcher@1, [object Object]]){CancelledContinuation[JobCancellationException: Parent job is Cancelling; job=TimeoutCoroutine(timeMillis=1000){Cancelled}@2]}@3. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
at CancellableContinuationImpl.DispatchedTask.handleFatalException_mseuzz$ (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:32457:16)
at CancellableContinuationImpl.DispatchedTask.run (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:32450:10)
at SetTimeoutBasedDispatcher$ScheduledMessageQueue.MessageQueue.process (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:35741:15)
at /Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:35557:30
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
'message_q7r8iu$_0': "Fatal exception in coroutines machinery for CancellableContinuation(DispatchedContinuation[NodeDispatcher@1, [object Object]]){CancelledContinuation[JobCancellationException: Parent job is Cancelling; job=TimeoutCoroutine(timeMillis=1000){Cancelled}@2]}@3. Please read KDoc to 'handleFatalException' method and report this incident to maintainers",
'cause_us9j0c$_0': ClassCastException: Illegal cast
at throwCCE_0 (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlin/1.3.70/kotlin/exceptionUtils.kt:15:11)
at NodeDispatcher.CoroutineDispatcher.releaseInterceptedContinuation_k98bjh$ (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:1896:84)
at Coroutine$StompSessionReceiptTests$send_autoReceipt_failsOnWebSocketError$lambda.CoroutineImpl.releaseIntercepted_0 (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlin/1.3.70/kotlin/coroutines/CoroutineImpl.kt:75:48)
at Coroutine$sendAndWaitForReceipt_0.CoroutineImpl.resumeWith_tl1gpc$ (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlin/1.3.70/kotlin/coroutines/CoroutineImpl.kt:56:17)
at ScopeCoroutine.afterResume_s8jyv4$ (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:33020:14)
at ScopeCoroutine.AbstractCoroutine.resumeWith_tl1gpc$ (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:412:8)
at Coroutine$sendText_61zpoe$.CoroutineImpl.resumeWith_tl1gpc$ (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlin/1.3.70/coroutines/Continuation.kt:53:5)
at CancellableContinuationImpl.DispatchedTask.run (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:32427:22)
at SetTimeoutBasedDispatcher$ScheduledMessageQueue.MessageQueue.process (/Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:35741:15)
at /Users/jbion/projects/krossbow/build/js/packages_imported/kotlinx-coroutines-core/1.3.3/kotlinx-coroutines-core.js:35557:30
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
'message_8yp7un$_0': 'Illegal cast',
'cause_th0jdv$_0': null,
name: 'ClassCastException'
},
name: 'CoroutinesInternalError'
}