New test run in Kotlin/JS

Has anyone successfully created a project where they have a separate JS compilation and test run using it? I’m using the IR compiler in a multiplatform project, if that makes any difference.

At first it seems like the way you’re supposed to do this is use the testRuns container, with something like:

kotlin {
    js(IR) {
        browser {
            testRuns.create("myNewTestRun")
        }
    }
}

However this doesn’t create a test task or do any configuration because when the configuration takes place in KotlinJsIrSubTarget.configureTestRunDefaults(), for some reason the code only runs the private method configureTestsRun() for the main test compilation.

In Kotlin 1.6 I was getting my project to work ok by running configureTestsRun() on my own test run using reflection. However that broke in 1.8, and what happens now is that (a bit bizarrely) the standard library in the main test compilation is missing several thousand lines of code.

Any insight would be appreciated.

2 Likes