From 497251a6d7adc450bb4e24f4b872bc414ac913ab Mon Sep 17 00:00:00 2001 From: Anton Bannykh Date: Wed, 13 Sep 2017 20:11:11 +0300 Subject: [PATCH] Revert "JS: use Mocha + NodeJs instead of Karma + PhantomJs to run stdlib tests" so that it wouldn't clash with Gradle Build transition This reverts commit 11c83ad --- libraries/stdlib/js/build.gradle | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/libraries/stdlib/js/build.gradle b/libraries/stdlib/js/build.gradle index ab78d30de80..6b4fe8458be 100644 --- a/libraries/stdlib/js/build.gradle +++ b/libraries/stdlib/js/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.moowork.node" version "1.2.0" + id 'com.craigburke.karma' version '1.4.4' } description = 'Kotlin Standard Library for JS' @@ -21,6 +21,7 @@ def jsSrcJsDir = "${jsSrcDir}/js" def jsOutputFile = "${buildDir}/classes/kotlin.js" def jsTestOutputFile = "${buildDir}/classes/test/kotlin-stdlib-js_test.js" def kotlinTestJsOutputFile = "${project(':kotlin-test:kotlin-test-js').buildDir}/classes/main/kotlin-test.js" +def kotlinTestJsTestOutputFile = "${project(':kotlin-test:kotlin-test-js').buildDir}/classes/test/kotlin-test-js_test.js" sourceSets { @@ -128,7 +129,7 @@ compileKotlin2Js { compileTestKotlin2Js { dependsOn preprocessSourcesTest kotlinOptions { - moduleKind = "umd" + moduleKind = "plain" } } @@ -253,33 +254,32 @@ dist { } } -task populateNodeModules(type: Copy, dependsOn: [compileJs, compileTestKotlin2Js]) { - from jsOutputFile - from kotlinTestJsOutputFile - into "${buildDir}/node_modules" -} +karma { + dependencies(['qunitjs@1.23.1', 'karma-teamcity-reporter@0.1.2']) -node { - download = true -} - -task installMocha(type: NpmTask) { - args = ['install', 'mocha'] -} - -task installTeamcityReporter(type: NpmTask) { - args = ['install', 'mocha-teamcity-reporter'] -} - -task runMocha(type: NodeTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, installMocha]) { - script = file('node_modules/.bin/mocha') - args = [jsTestOutputFile] + frameworks = ['qunit'] + browsers = ['PhantomJS'] if (project.hasProperty("teamcity")) { - dependsOn installTeamcityReporter - args = ["--reporter", "mocha-teamcity-reporter"] + args + reporters = ['teamcity'] + } + + profile('default') { + libraryBases = [''] + libraryFiles = [jsOutputFile, kotlinTestJsOutputFile] + + sourceBases = [] + sourceFiles = [] + + testBases = [''] + testFiles = [jsTestOutputFile, kotlinTestJsTestOutputFile] } } -test.dependsOn runMocha \ No newline at end of file +karmaGenerateConfig.outputs.upToDateWhen { false } +karmaRun { + dependsOn testClasses + dependsOn tasks.getByPath(':kotlin-test:kotlin-test-js:testClasses') +} +clean.dependsOn karmaClean