blob: 652e50044051cc73c3e3155220e534835459ffc7 [file] [log] [blame]
plugins {
id "com.moowork.node" version "1.2.0"
}
description = 'Kotlin-test integration tests for JS'
apply plugin: 'kotlin-platform-js'
dependencies {
compile project(':kotlin-test:kotlin-test-js')
}
// package.json contains direct links to the builddir
buildDir = "$projectDir/build"
[compileKotlin2Js, compileTestKotlin2Js]*.configure {
kotlinOptions.moduleKind = "commonjs"
}
task populateNodeModules(type: Copy, dependsOn: compileKotlin2Js) {
from compileKotlin2Js.destinationDir
configurations.testCompile.each {
from zipTree(it.absolutePath).matching { include '*.js' }
}
into "${buildDir}/node_modules"
}
node {
download = true
}
def createFrameworkTest(def name) {
return tasks.create("test$name", NpmTask) {
dependsOn(compileTestKotlin2Js, populateNodeModules, npmInstall)
def lowerName = name.toLowerCase()
args = ['run', "test-$lowerName"]
group = 'verification'
execOverrides {
it.ignoreExitValue = true
it.standardOutput = new FileOutputStream("$buildDir/test-${lowerName}.log")
it.errorOutput = new FileOutputStream("$buildDir/test-${lowerName}.err.log")
}
doLast {
println file("$buildDir/tc-${lowerName}.log").text
if (result.exitValue != 0 && !rootProject.ignoreTestFailures) {
throw new GradleException("$name integration test failed")
}
}
}
}
['Jest', 'Jasmine', 'Mocha', 'Qunit', 'Tape'].each {
check.dependsOn createFrameworkTest(it)
}