JS: clean up the unit test intergartion tests build file

This commit is contained in:
Anton Bannykh
2017-08-15 15:54:27 +03:00
parent 226ffb6c7e
commit a641838368
7 changed files with 12 additions and 33 deletions
+12 -33
View File
@@ -10,46 +10,25 @@ dependencies {
compile project(':kotlin-test:kotlin-test-js') compile project(':kotlin-test:kotlin-test-js')
} }
[compileKotlin2Js, compileTestKotlin2Js]*.configure {
sourceSets { kotlinOptions.moduleKind = "commonjs"
main.kotlin.srcDirs += 'src'
test.kotlin.srcDirs += 'test'
} }
task populateNodeModules(type: Copy, dependsOn: compileKotlin2Js) {
from compileKotlin2Js.destinationDir
compileKotlin2Js { configurations.testCompile.each {
kotlinOptions { from zipTree(it.absolutePath).matching { include '*.js' }
moduleKind = "commonjs"
} }
}
compileTestKotlin2Js { into "${buildDir}/classes"
kotlinOptions {
moduleKind = "commonjs"
}
}
compileKotlin2Js.doLast {
configurations.compile.each { File file ->
copy {
includeEmptyDirs = false
from zipTree(file.absolutePath)
into "${buildDir}/classes/"
include { fileTreeElement ->
def path = fileTreeElement.path
path.endsWith(".js") && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/"))
}
}
}
} }
node { node {
version = '6.11.0'
download = true download = true
} }
task testJest(type: NpmTask, dependsOn: [compileTestKotlin2Js, compileTestKotlin2Js, npmInstall]) { task testJest(type: NpmTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, npmInstall]) {
args = ['run', 'test-jest'] args = ['run', 'test-jest']
execOverrides { execOverrides {
it.standardOutput = new FileOutputStream("$buildDir/test-jest.log") it.standardOutput = new FileOutputStream("$buildDir/test-jest.log")
@@ -57,28 +36,28 @@ task testJest(type: NpmTask, dependsOn: [compileTestKotlin2Js, compileTestKotlin
} }
} }
task testJasmine(type: NpmTask, dependsOn: [compileTestKotlin2Js, compileTestKotlin2Js, npmInstall]) { task testJasmine(type: NpmTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, npmInstall]) {
args = ['run', 'test-jasmine'] args = ['run', 'test-jasmine']
execOverrides { execOverrides {
it.standardOutput = new FileOutputStream("$buildDir/test-jasmine.log") it.standardOutput = new FileOutputStream("$buildDir/test-jasmine.log")
} }
} }
task testMocha(type: NpmTask, dependsOn: [compileTestKotlin2Js, compileTestKotlin2Js, npmInstall]) { task testMocha(type: NpmTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, npmInstall]) {
args = ['run', 'test-mocha'] args = ['run', 'test-mocha']
execOverrides { execOverrides {
it.standardOutput = new FileOutputStream("$buildDir/test-mocha.log") it.standardOutput = new FileOutputStream("$buildDir/test-mocha.log")
} }
} }
task testQunit(type: NpmTask, dependsOn: [compileTestKotlin2Js, compileTestKotlin2Js, npmInstall]) { task testQunit(type: NpmTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, npmInstall]) {
args = ['run', 'test-qunit'] args = ['run', 'test-qunit']
execOverrides { execOverrides {
it.standardOutput = new FileOutputStream("$buildDir/test-qunit.log") it.standardOutput = new FileOutputStream("$buildDir/test-qunit.log")
} }
} }
task testTape(type: NpmTask, dependsOn: [compileTestKotlin2Js, compileTestKotlin2Js, npmInstall]) { task testTape(type: NpmTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, npmInstall]) {
args = ['run', 'test-tape'] args = ['run', 'test-tape']
execOverrides { execOverrides {
it.standardOutput = new FileOutputStream("$buildDir/test-tape.log") it.standardOutput = new FileOutputStream("$buildDir/test-tape.log")