Hi folks - I am a newbie to kotlin - trying to tes...
# multiplatform
a
Hi folks - I am a newbie to kotlin - trying to test kotlinjs output with mocha framework - tests are running , but the html report file generated is showing 0 tests(/build/classess/reports/tests/test/index.html). Can anyone pls help out here ? looking for a report in html/xml format. Thanks!!
Copy code
compileKotlin2Js {
    kotlinOptions {
        metaInfo = true
        outputFile = "${project.buildDir.path}/classes/main/${project.name}.js"
        sourceMap = true
        sourceMapEmbedSources = "always"
        moduleKind = 'umd'
    }
}
compileTestKotlin2Js { kotlinOptions.moduleKind = 'umd' }
task populateNodeModules(type: Copy, dependsOn: compileTestKotlin2Js) {
    from compileKotlin2Js.destinationDir
    configurations.testCompile.each {
        from zipTree(it.absolutePath).matching { include '*.js' }
    }
    into "${buildDir}/node_modules"
}
node {
    download = true
}
task installMocha(type: NpmTask) {
    args = ['install', 'mocha']
}
task yarnInstall(type: YarnTask) {
    args = ['install']
}
task runMocha(type: NodeTask, dependsOn: [compileTestKotlin2Js, populateNodeModules,yarnInstall, installMocha]) {
    script = file('node_modules/mocha/bin/mocha')
    args = [compileTestKotlin2Js.outputFile]
}
task runTest {
    dependsOn runMocha
}
test.dependsOn runTest
i
Hello, why don’t you use standard testing, provided by Kotlin/JS gradle plugin? Since 1.3.40 plugin does all routines and you can only write tests and run it Just run nodeTest (or check/test, in which nodeTest included), and everything should work HTML report is generated by Kotlin/JS gradle plugin with resulting of its own test running Additionally, you can use #javascript to ask questions related only with Kotlin/JS