Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ClassCastException in wasmJs tests with Kotlin 2.2.20 #111

@CXwudi

Description

@CXwudi

Bug Report

Several wasmJs test cases crash with ClassCastException: Cannot cast null to [Type]: target type is non-nullable when using Mokkery 2.10.0. This issue only affects wasmJs target, not regular JS target.

Reproduction

Repository: https://github.com/CXwudi/realworld-compose-http4k-example-app/tree/de6f349d6a437faf9387de36f6707cbb47b58438

Steps to reproduce:

  1. Revert Mokkery version from 3.0.0-Beta2 to 2.10.0 in build-src/libs.versions.toml:
pluginDep-mokkery = "dev.mokkery:mokkery-gradle:2.10.0"
  1. Run tests in conduit-frontend folder:
./gradlew :frontend-decompose-logic:wasmJsBrowserTest --debug > log.log

Stack Trace

ClassCastException: Cannot cast null to UserUpdateDto: target type is non-nullable
    at kotlin.createJsError(C:/Users/<user>/AppData/Local/Temp/_karma_webpack_286865/commons.js:13727)
    at <conduit-frontend:frontend-decompose-logic_test>.kotlin.createJsError__externalAdapter(C:/Users/<user>/AppData/Local/Temp/_karma_webpack_286865/25f752483807ee4a5a0f.wasm)
    at <conduit-frontend:frontend-decompose-logic_test>.kotlin.wasm.internal.THROW_CCE_WITH_INFO(C:/Users/<user>/AppData/Local/Temp/_karma_webpack_286865/25f752483807ee4a5a0f.wasm)
    at slambda.invoke(C:/Users/<user>/AppData/Local/Temp/_karma_webpack_286865/25f752483807ee4a5a0f.wasm)
    at slambda.invoke(C:/Users/<user>/AppData/Local/Temp/_karma_webpack_286865/25f752483807ee4a5a0f.wasm)

Environment

  • Mokkery: 2.10.0 → 3.0.0-Beta2 (fixed)
  • Kotlin: 2.2.20
  • Platform: Windows 10, ChromeHeadless 129.0.0.0

Notes

  • Only 5 test cases affected in wasmJs target
  • Same tests pass in regular JS target
  • Fixed by upgrading to 3.0.0-Beta2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions