How can I opt-in to the new browser testing mechan...
# javascript
c
How can I opt-in to the new browser testing mechanism from a convention plugin that may be applied to projects that don't have JS targets at all?
h
Use another convention plugin 🤷🏻‍♂️
c
I already have so many 😓
a
CC: @Anton Lakotka [JB] @Adam Semenenko
a
Please make an issue. I think there are a other new features added that have similar problems because they don't support the Provider API. An issue would help a lot.
a
How can I opt-in to the new browser testing mechanism from a convention plugin that may be applied to projects that don't have JS targets at all?
Copy code
kotlin {
    targets.configureEach {
        if (this is KotlinJsIrTarget) {
            subTargets.configureEach {
                if (this is KotlinJsBrowserDsl) {
                    test {
                        firefox()
                    }
                }
            }
        }
    }
}
I guess this should work.
c
Sorry for the time it's taken me to get back to this. The new DSL should be available in 2.4.21, right?
a
yes, it should be available See "DSL for browser testing" https://kotlinlang.org/docs/js-running-tests.html#z684gqq_39
c
Ah, I see, I have a weird version resolution issue in Gradle and I'm apparently not using the KGP version I thought I was 😕 It seems to work, I have Playwright being installed locally
Related: KT-91232 Gradle, JS: Allow code-less configuration of the browser using the new DSL
thank you color 1
Had to add a
&& platformType == KotlinPlatformType.js
otherwise it breaks
wasmJS