Skip to content

Commit

Permalink
Use karma plugin to run kotlin-stdlib-js tests.
Browse files Browse the repository at this point in the history
Also create html page to run tests interactively in browser.

Use karma-teamcity-reporter 0.1.2 to workaround karma-runner/karma-teamcity-reporter#38

(cherry picked from commit 325ebfb)
  • Loading branch information
ilya-g committed Apr 6, 2017
1 parent 043a3c9 commit 29f04dd
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
1 change: 1 addition & 0 deletions libraries/stdlib/js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
35 changes: 34 additions & 1 deletion libraries/stdlib/js/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
id 'com.craigburke.karma' version '1.4.4'
}

description = 'Kotlin Standard Library for JS'

apply plugin: 'kotlin2js'
Expand All @@ -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 {
Expand Down Expand Up @@ -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 changes: 20 additions & 0 deletions libraries/stdlib/js/web/index.html
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 29f04dd

Please sign in to comment.