From 29f04dd32a8e4ac4529a3caa08cadd25d2728eb9 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 28 Mar 2017 02:00:17 +0300 Subject: [PATCH] Use karma plugin to run kotlin-stdlib-js tests. Also create html page to run tests interactively in browser. Use karma-teamcity-reporter 0.1.2 to workaround https://github.com/karma-runner/karma-teamcity-reporter/issues/38 (cherry picked from commit 325ebfbd5f74d9249d99c76d5369135a90634fc2) --- libraries/stdlib/js/.gitignore | 1 + libraries/stdlib/js/build.gradle | 35 +++++++++++++++++++++++++++++- libraries/stdlib/js/web/index.html | 20 +++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 libraries/stdlib/js/.gitignore create mode 100644 libraries/stdlib/js/web/index.html diff --git a/libraries/stdlib/js/.gitignore b/libraries/stdlib/js/.gitignore new file mode 100644 index 0000000000000..b512c09d47662 --- /dev/null +++ b/libraries/stdlib/js/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/libraries/stdlib/js/build.gradle b/libraries/stdlib/js/build.gradle index 3608c6c29a463..d3eb84fa18bd3 100644 --- a/libraries/stdlib/js/build.gradle +++ b/libraries/stdlib/js/build.gradle @@ -1,3 +1,7 @@ +plugins { + id 'com.craigburke.karma' version '1.4.4' +} + description = 'Kotlin Standard Library for JS' apply plugin: 'kotlin2js' @@ -11,6 +15,8 @@ def jsSrcDir = "${jsLibrariesDir}/src" def jsTestSrcDir = "${jsLibrariesDir}/test" 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" sourceSets { builtinsFiles { @@ -207,4 +213,31 @@ artifacts { archives mergedJar archives sourcesJar archives javadocJar -} \ No newline at end of file +} + + +karma { + dependencies(['qunitjs@1.23.1', 'karma-teamcity-reporter@0.1.2']) + + frameworks = ['qunit'] + browsers = ['PhantomJS'] + + if (project.hasProperty("teamcity")) { + reporters = ['teamcity'] + } + + profile('default') { + libraryBases = [''] + libraryFiles = [jsOutputFile, kotlinTestJsOutputFile] + + sourceBases = [] + sourceFiles = [] + + testBases = [''] + testFiles = [jsTestOutputFile] + } +} + +karmaGenerateConfig.outputs.upToDateWhen { false } +karmaRun.dependsOn testClasses +clean.dependsOn karmaClean diff --git a/libraries/stdlib/js/web/index.html b/libraries/stdlib/js/web/index.html new file mode 100644 index 0000000000000..e96a0a2705f02 --- /dev/null +++ b/libraries/stdlib/js/web/index.html @@ -0,0 +1,20 @@ + + + + + Kotlin Standard Library Test Suite + + + + + + + + + + + +
+
+ + \ No newline at end of file