Hi all! When running wasmJs tests on a project tha...
# testballoon
d
Hi all! When running wasmJs tests on a project that uses Kotlin Toolchain, I observe that some escaping of some test names might not be done correctly and produces parsing errors on Kotlin Toolchain side (stack trace in thread). I don’t observe this on other platform (those are common tests).
The test name contains single quotes:
Copy code
test("LocalSettingsTree isolates path segments containing '/' and restores across restarts.") {
            // ...
        }
Here is the parse error on KTC side:
Copy code
WARN  Failed to parse message ##teamcity[testStarted name='LocalSettingsTree isolates path segments containing |'/|' and restores across restarts|0x00b7' timestamp='2026-11-29T13:16:50.875'|0x29f8|'|0x00a0and|0x00a0restores|0x00a0across|0x00a0restarts.']: java.text.ParseException: Error while parsing TeamCity service message: Property value not found (no "=" character). Valid service message has a form of "##teamcity[messageName name1='escaped_value' name2='escaped_value']" where escaped_value uses substitutions: '->|', [->|[, ]->|], |->||, newline->|n
        at jetbrains.buildServer.messages.serviceMessages.MapSerializerUtil.parseName(MapSerializerUtil.java:139)
        at jetbrains.buildServer.messages.serviceMessages.MapSerializerUtil.stringToProperties(MapSerializerUtil.java:116)
        at jetbrains.buildServer.messages.serviceMessages.ServiceMessage.parseAttributes(ServiceMessage.java:239)
        at jetbrains.buildServer.messages.serviceMessages.ServiceMessage.init(ServiceMessage.java:390)
        at jetbrains.buildServer.messages.serviceMessages.ServiceMessagesParser.doParse(ServiceMessagesParser.java:108)
        at jetbrains.buildServer.messages.serviceMessages.ServiceMessagesParser.parse(ServiceMessagesParser.java:75)
        at org.jetbrains.amper.teamcity.events.TeamCityMessageProcessor.parse(TeamCityMessageProcessor.kt:64)
        at org.jetbrains.amper.tasks.wasm.BrowserTestTask$runTestsInBrowser$2$1$1$1$1$1$1.accept(BrowserTestTask.kt:243)
        at org.jetbrains.amper.tasks.wasm.BrowserTestTask$runTestsInBrowser$2$1$1$1$1$1$1.accept(BrowserTestTask.kt:235)
        at com.microsoft.playwright.impl.ListenerCollection.notify(ListenerCollection.java:45)
        at com.microsoft.playwright.impl.BrowserContextImpl.handleEvent(BrowserContextImpl.java:814)
        at com.microsoft.playwright.impl.Connection.dispatch(Connection.java:307)
        at com.microsoft.playwright.impl.Connection.processOneMessage(Connection.java:222)
        at com.microsoft.playwright.impl.ChannelOwner.runUntil(ChannelOwner.java:144)
        at com.microsoft.playwright.impl.PageImpl.waitForCondition(PageImpl.java:1620)
        at com.microsoft.playwright.Page.waitForCondition(Page.java:8542)
        at org.jetbrains.amper.tasks.wasm.BrowserTestTask$runTestsInBrowser$2$1$1.invokeSuspend(BrowserTestTask.kt:255)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
o
If I run a JVM test with the above name and inspect the TestBalloon-generated TeamCity messages, I’m seeing
Copy code
##teamcity[testStarted name='LocalSettingsTree isolates path segments containing |'/|' and restores across restarts|0x00b7' timestamp='2026-11-30T18:54:34.333' flowId='com.example.CommonTestBalloon|0x2198LocalSettingsTree|0x00a0isolates|0x00a0path|0x00a0segments|0x00a0containing|0x00a0|'|0x29f8|'|0x00a0and|0x00a0restores|0x00a0across|0x00a0restarts.']
Everything looks correct, including the single quote which is escaped by prefixing it with a pipe character (
|
) as specified by Kotlin Toolchain’s error message >
Copy code
where escaped_value uses substitutions: '->|',
and conforming to the TeamCity protocol specification: jetbrains.com/help/teamcity/service-messages.html#… If I run a JVM test with the above name via
Copy code
./kotlin test ... --format=teamcity
I’m seeing this line in the output
Copy code
##teamcity[testStarted name='Common|0x00a0with|0x00a0a|0x00a0name: LocalSettingsTree isolates path segments containing |'/|' and restores across restarts|0x00b7' flowId='|[engine:de.infix.testBalloon|]/|[suite:com.example.CommonTestBalloonSuite2|]/|[test:LocalSettingsTree isolates path segments containing |'%2F|' and restores across restarts.|]-773326a6-b208-43e1-a217-6ab8e9ef2922' displayName='LocalSettingsTree isolates path segments containing |'/|' and restores across restarts|0x00b7']
which shows the TeamCity message as modified by Kotlin Toolchain. The single quotes are escaped correctly, but using
%2F
instead of the forward slash (
/
) looks unusual. TestBalloon does not produce such encoding. Unfortunately, I cannot reproduce anything for
wasmJs
, as I’m getting a Kotlin Toolchain error on Linux:
Copy code
ERROR Error: Cannot find module '.../kotlin-toolchain-arena/build/tasks/_usingTestBalloon_testWasmJsDebug/playwright-project/node_modules/playwright/cli.js'
If all of this makes sense, could you file a bug with Kotlin Toolchain?
The
wasmJs
“Cannot find module” error I was observing with Kotlin Toolchain is now filed as youtrack.jetbrains.com/issue/KTC-6194. It reproduces in a simple module using just
kotlin.test
.
d
Hey @Oliver.O! Thanks a lot for your answer. I am not sure I really understand what's happening or where the problem is. Though, if I compare the TeamCity message I pasted w.r.t. the one you produced on JVM, note that in my message, after the
timestamp
attribute's end single quote there is some strange content which definitely looks like the end of the
flowId
attribute in your TC message (which isn't in mine).
It looks like there is only the last part of the test name (after the last escaped single quote), with an additional space encoding. Whereas your
flowId
attribute contains the full test name.
o
I agree, it looks like your TeamCity message got mangled somehow. As you have noticed, it only happens with
wasmJs
tests (which KTC fails to run on my machine). We’re seeing at least one bug which is definitely caused by KTC (KTC-6194), and the second one (your error) seems likely to be caused by KTC. The best option is to file a bug against KTC with a reproducer, and additionally check whether it’s the single quote or the slash character. In addition, please ask on #kotlin-toolchain, as that’s probably still the fastest way of getting something triaged.
👍 1