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
This commit is contained in:
Ilya Gorbunov
2017-03-28 02:00:17 +03:00
parent dedf9fe898
commit 325ebfbd5f
3 changed files with 55 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
node_modules
+34 -1
View File
@@ -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
}
}
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
+20
View File
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Kotlin Standard Library Test Suite</title>
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
<!-- paths are setup for local file run -->
<!-- run karmaDependencies gradle task to fetch qunit -->
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script src="../build/classes/kotlin.js"></script>
<script src="../../../kotlin.test/js/build/classes/main/kotlin-test.js"></script>
<script src="../build/classes/test/kotlin-stdlib-js_test.js"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</body>
</html>