Skip to content

Wasm/JS/Browser: Configuration errors are not reported as expected #21

@OliverO2

Description

@OliverO2

Given a defective test configuration triggering a runtime error:

import de.infix.testBalloon.framework.TestDiscoverable
import de.infix.testBalloon.framework.TestSuite
import de.infix.testBalloon.framework.testSuite

val outer by testSuite {
    @TestDiscoverable
    fun customTest1(name: String, action: suspend () -> Unit) = test(name) {
        action()
    }

    @TestDiscoverable
    fun TestSuite.customTest2(name: String, action: suspend () -> Unit) = test(name) {
        action()
    }

    testSuite("inner") {
        customTest1("not OK") { // registering a test in `outer`, invoked in `inner`
        }
        customTest2("OK") {
        }
    }
}

TestBalloon usually reports it like in this JVM example:

TestEngine with ID 'de.infix.testBalloon' encountered a critical issue during test discovery:

(1) [ERROR] 	Could not configure outer.inner
	java.lang.IllegalArgumentException: Test(outer.not OK) tried to register as a child of TestSuite(outer), which currently is not the closest configuration scope.
		The closest configuration scope at this point is TestSuite(outer.inner).
		at CustomFunctionWithWrongParentSuiteKt.outer_delegate$lambda$1$customTest1(customFunctionWithWrongParentSuite.kt:7)
		[...]

This is not the case with Wasm/JS/Browser:

Task Meaningful error message Task failure
jvmTest Yes Yes
linuxX64Test Yes Yes
jsNodeTest Yes Yes
jsBrowserTest Yes Yes
wasmJsBrowserTest No Yes
wasmJsNodeTest Yes Yes
wasmWasiNodeTest Yes Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛Product not working as expectedCompatibility 💕Product compatibility with the ecosystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions