From 1c26d7212f3aead9f17e575f59ba168cbeae7e6d Mon Sep 17 00:00:00 2001 From: James Strachan Date: Thu, 21 Jun 2012 16:12:23 +0100 Subject: [PATCH] added some documentation on how the JavaScript generation and testing of the standard library works --- js/ReadMe.md | 17 +++++++++++++++++ libraries/tools/kotlin-js-tests/ReadMe.md | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 js/ReadMe.md diff --git a/js/ReadMe.md b/js/ReadMe.md new file mode 100644 index 00000000000..837cf08bfce --- /dev/null +++ b/js/ReadMe.md @@ -0,0 +1,17 @@ +# JavaScript Translation + +This module performs the translation of Kotlin source code to JavaScript. + +There are various Kotlin APIs to JavaScript environments and libraries in the [js.libraries](https://github.com/JetBrains/kotlin/tree/master/js/js.libraries/src) project. + +## Compiling the standard Kotlin library to JavaScript + +* the [kotlin-js-library](https://github.com/JetBrains/kotlin/tree/master/libraries/tools/kotlin-js-library) module creates a jar containing all the Kotlin source code for the runtime and standard kotlin library code (both definitions and implementation code) to be compiled to JavaScript. +* the [kotlin-js-tests](https://github.com/JetBrains/kotlin/tree/master/libraries/tools/kotlin-js-tests) module then compiles a selection of test cases from the [Kotlin standard library for the JVM](https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib) to JavaScript. These tests can then be [run in a web browser using QUnit](https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-js-tests/ReadMe.md) +* the [kotlin-js-tests-junit](https://github.com/JetBrains/kotlin/tree/master/libraries/tools/kotlin-js-tests-junit) then [runs the JavaScript tests for the standard library inside JUnit](https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-js-tests-junit/ReadMe.md) using Selenium and the underlying JavaScript & QUnit so that the JavaScript can be tested as part of the maven continuous integration build. + +## Reusing JVM based test cases in JavaScript + +Any Kotlin test cases using the **org.junit.Test** annotation and the [kotlin.test](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/test/package-summary.html) package, such as [this test case](https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/test/StringTest.kt#L5) are automatically converted to JavaScript using [QUnit](http://qunitjs.com/). + +This allows the test cases to be [ran directly in a web page in any web browser](https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-js-tests/ReadMe.md). \ No newline at end of file diff --git a/libraries/tools/kotlin-js-tests/ReadMe.md b/libraries/tools/kotlin-js-tests/ReadMe.md index 55154ae2743..066468f7833 100644 --- a/libraries/tools/kotlin-js-tests/ReadMe.md +++ b/libraries/tools/kotlin-js-tests/ReadMe.md @@ -2,6 +2,6 @@ This module generates the JavaScript code for a number of JUnit test cases from the stdlib module. -The tests can then be ran inside any browser by opening the **src/test/web/index.html* file in this directory to run the test cases using [Qunit](http://qunitjs.com/) +The tests can then be ran inside any browser by opening the **src/test/web/index.html** file in this directory to run the test cases using [Qunit](http://qunitjs.com/) -To run the tests in JUnit as part of the maven build, see the **../kotlin-js-tests-runner* module \ No newline at end of file +To run the tests in JUnit as part of the maven build, see the **../kotlin-js-tests-runner** module \ No newline at end of file