Edoardo Luppi
04/12/2026, 9:09 AMexport async function run(): Promise<void> {
const mocha = new Mocha({ ... });
// Omitted
return new Promise<void>((resolve, reject) => {
// Run the mocha test suite
mocha.run((failures) => {
if (failures === 0) {
resolve();
} else {
reject(new Error(`${failures} tests failed.`));
}
});
});
}
Where a promise is rejected in case of test case failures.
Does TestBalloon support registering/discovering tests through a custom function?
I did investigate this a long time ago, and couldn't figure out anything with kotlin.test.Oliver.O
04/12/2026, 10:03 AMEdoardo Luppi
04/12/2026, 10:11 AMregistering tests and test suites via custom functionsThat happens under a test suite scope tho, right? Inside my
export async function run(): Promise<void> function I will have to register TestBalloon test suites instead of test cases.Edoardo Luppi
04/12/2026, 10:13 AMEdoardo Luppi
04/12/2026, 10:17 AMEdoardo Luppi
04/12/2026, 10:19 AM// TestSuiteOne.kt
val TestSuiteOne by testSuite { ... }
// TestSuiteTwo.kt
val TestSuiteTwo by testSuite { ... }
// Run.kt
@JsExport
fun run(): Promise<Unit> {
register(TestSuiteOne)
register(TestSuiteTwo)
// Somehow execute those suites
}
That means I'd be able to use both gutter icons, and VS Code run configurations.Oliver.O
04/12/2026, 10:53 AMThat happens under a test suite scope tho, right?Yes.
That would mean replacing the test framework, right? Discovery of top-level suites and creating an entry point (Copy code// Somehow execute those suites
main-like function) is the job of TestBalloon's compiler plugin. Registration and execution is the primary job of TestBalloon's core library. Run gutter icons are the territory of TestBalloon's IDE plugin, which uses the IDE's and the Kotlin compiler's code analysis. And then there's integration (the rest of the owl).Oliver.O
04/12/2026, 11:01 AMrun entry point for VS Code in addition to the regular Kotlin/JS entry point.
• How would VS Code handle test reporting (Kotlin/JS uses the TeamCity protocol for that)?
• How would VS Code detect test suites and tests to provide run gutter icons?Edoardo Luppi
04/12/2026, 11:05 AMEdoardo Luppi
04/12/2026, 11:07 AMOliver.O
04/12/2026, 11:11 AMEdoardo Luppi
04/12/2026, 11:14 AMrun function, which executes the test suites.Oliver.O
04/12/2026, 11:16 AMEdoardo Luppi
04/12/2026, 11:17 AMEdoardo Luppi
04/12/2026, 11:18 AMOliver.O
04/12/2026, 11:22 AMEdoardo Luppi
04/12/2026, 11:24 AMEdoardo Luppi
04/12/2026, 11:25 AMEdoardo Luppi
04/12/2026, 11:27 AMOliver.O
04/12/2026, 3:06 PMTestConfig.executionReport, so no need to deal with TeamCity conversion. But proper IDE integration is non-trivial and I wonder who‘d create a VS Code extension. What we covered here was just the surface of the JS part.Edoardo Luppi
04/12/2026, 3:13 PMOliver.O
04/12/2026, 3:15 PMEdoardo Luppi
04/12/2026, 3:24 PMEdoardo Luppi
04/12/2026, 3:25 PMnode tests.jsOliver.O
04/12/2026, 6:51 PMsuspend fun main(arguments: Array<String>)
because that's what the TestBalloon compiler plugin generates for JS. With it, TestBalloon would run all its tests. If there is a Mocha-style test framework present (describe and it functions), it would use that (not recommended for standalone execution). Otherwise, it would run them directly (better).Edoardo Luppi
04/12/2026, 6:55 PMmain entry point? I could customize the Gradle task depending on a project parameter and have it called run for example. Stuff like that.Oliver.O
04/12/2026, 7:05 PMrun, why can't it call main?Edoardo Luppi
04/12/2026, 7:06 PMOliver.O
04/12/2026, 7:07 PMrun just calls main?Edoardo Luppi
04/12/2026, 7:10 PMOliver.O
04/12/2026, 7:14 PMEdoardo Luppi
04/12/2026, 7:20 PMmain might be mangled by the Kotlin compiler. I can definitely use a custom test reporter, but I need to check how it would work as everything should be done at compile time. The best approach would be for the run function to be in Kotlin too, and it being able to call main.Edoardo Luppi
04/12/2026, 7:26 PMmain would be executed at JS module load. That's a big issue because it means as soon the test harness loads the file, tests run, instead of waiting for a run call.Oliver.O
04/12/2026, 7:39 PMEdoardo Luppi
04/12/2026, 7:40 PMEdoardo Luppi
04/12/2026, 7:41 PM