andylamax
09/13/2021, 1:45 AMandylamax
09/13/2021, 1:46 AMval compilation = compilations.create("test${it.capitalize()}").apply {
defaultSourceSet {
this.kotlin.srcDir("$targetSource/test/$it/kotlin")
resources.srcDir("$targetSource/test/$it/resources")
dependencies {
implementation(test.runtimeDependencyFiles)
}
}
}
val file = File(compilation.output.allOutputs.files.first().absoluteFile, "$it-test.js").apply {
if (!exists()) createNewFile()
}
val binary = binaries.executable(compilation)
project.tasks.register("$name${it.capitalize()}Test", KotlinJsTest::class.java, compilation).configure {
dependsOn(compilation.compileKotlinTask)
testFramework = defaultTestTask.testFramework
inputFileProperty.set(file)
binaryResultsDirectory.set(defaultTestTask.binaryResultsDirectory)
println(defaultTestTask.reports.enabledReports)
reports.enabledReports.putAll(defaultTestTask.reports.enabledReports)
}
andylamax
09/13/2021, 2:52 AMproject.tasks.register("$name${testName.capitalize()}Test", KotlinJsTest::class.java, compilation).configure {
dependsOn(compilation.compileKotlinTask)
testFramework = defaultTestTask.testFramework
inputFileProperty.set(project.layout.file(
binary.linkSyncTask.map {
it.destinationDir
.resolve(binary.linkTask.get().outputFileProperty.get().name)
}
))
val nodeJs = project.rootProject.extensions.getByType(NodeJsRootExtension::class.java)
// binaryResultsDirectory.set(defaultTestTask.binaryResultsDirectory)
dependsOn(nodeJs.npmInstallTaskProvider, nodeJs.nodeJsSetupTaskProvider)
binaryResultsDirectory.set(binary.linkSyncTask.get().destinationDir)
reports.html.outputLocation.set(defaultTestTask.reports.html.outputLocation)
reports.junitXml.outputLocation.set(defaultTestTask.reports.junitXml.outputLocation)
}
but now I am getting this error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bitframe-client-sdk-ktor:jsIntegrationTest'.
> DefaultExternalModuleDependency{group='org.jetbrains.kotlin', name='kotlin-test-js-runner', version='null', configuration='default'} required by task ':bitframe-client-sdk-ktor:jsIntegrationTest' was not found resolved at the time of nodejs package manager call. This may be caused by changing task ':bitframe-client-sdk-ktor:jsIntegrationTest' configuration after npm dependencies resolution.
andylamax
09/13/2021, 9:37 AM