Skip to content

Commit

Permalink
[Wasm] Use kotlin-web-helpers instead of kotlin-test-js-runner
Browse files Browse the repository at this point in the history
^KT-70621 fixed
^KT-70297 fixed
  • Loading branch information
ilgonmic authored and qodana-bot committed Aug 12, 2024
1 parent 1e2f74a commit a838951
Show file tree
Hide file tree
Showing 55 changed files with 22 additions and 4,500 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ build/
.idea/uiDesigner.xml
node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-js-runner/lib/
local.properties
buildSrcTmp/
distTmp/
Expand Down
1 change: 0 additions & 1 deletion .space/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@
/libraries/tools/kotlin-stdlib-docs/ A.Qurbonzoda Vsevolod.Tolstopyato Ilya.Gorbunov Filipp.Zhinkin
/libraries/tools/kotlin-stdlib-docs-legacy/ A.Qurbonzoda Vsevolod.Tolstopyato Ilya.Gorbunov Filipp.Zhinkin
/libraries/tools/kotlin-stdlib-gen/ A.Qurbonzoda Vsevolod.Tolstopyato Ilya.Gorbunov Filipp.Zhinkin
/libraries/tools/kotlin-test-js-runner/ "Kotlin Wasm"
/libraries/tools/kotlin-tooling-core/ "Kotlin Build Tools" "Kotlin in Fleet"
/libraries/tools/kotlin-tooling-metadata/ "Kotlin Build Tools"
/libraries/tools/kotlinp/ "Kotlin JVM" "Kotlin Common Backend"
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,6 @@ tasks {
register("jsCompilerTest") {
dependsOn(":js:js.tests:jsTest")
dependsOn(":js:js.tests:runMocha")
dependsOn(":kotlin-test-js-runner:test")
}

register("jsFirCompilerTest") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ val npmPackages = listOf(
NpmPackage("karma-webpack"),
NpmPackage("karma-sourcemap-loader"),
NpmPackage("typescript"),
NpmPackage("kotlin-web-helpers"),
)

data class NpmPackage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ class $class : Serializable {
#foreach( $dep in $dependencies )
val $dep.camelize() = NpmPackageVersion("$dep.name", "$dep.version")
#end

val kotlinJsTestRunner = KotlinGradleNpmPackage("test-js-runner")
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ class NpmVersions : Serializable {
val karmaWebpack = NpmPackageVersion("karma-webpack", "5.0.1")
val karmaSourcemapLoader = NpmPackageVersion("karma-sourcemap-loader", "0.4.0")
val typescript = NpmPackageVersion("typescript", "5.5.4")

val kotlinJsTestRunner = KotlinGradleNpmPackage("test-js-runner")
val kotlinWebHelpers = NpmPackageVersion("kotlin-web-helpers", "2.0.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ class KotlinCompilationNpmResolver(
}
}

// We don't have `kotlin-js-test-runner` in NPM yet
all.dependencies.add(rootResolver.versions.kotlinJsTestRunner.createDependency(project))

return all
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class KotlinKarma(

init {
requiredDependencies.add(versions.karma)
requiredDependencies.add(versions.kotlinWebHelpers)

useKotlinReporter()
useWebpackOutputPlugin()
Expand Down Expand Up @@ -152,11 +153,11 @@ class KotlinKarma(
it.appendLine(
"""
config.plugins = config.plugins || [];
config.plugins.push('kotlin-test-js-runner/karma-kotlin-reporter.js');
config.plugins.push('kotlin-web-helpers/dist/karma-kotlin-reporter.js');
config.loggers = [
{
type: 'kotlin-test-js-runner/tc-log-appender.js',
type: 'kotlin-web-helpers/dist/tc-log-appender.js',
//default layout
layout: { type: 'pattern', pattern: '%[%d{DATETIME}:%p [%c]: %]%m' }
}
Expand All @@ -176,7 +177,7 @@ class KotlinKarma(
it.appendLine(
"""
config.plugins = config.plugins || [];
config.plugins.push('kotlin-test-js-runner/karma-webpack-output.js');
config.plugins.push('kotlin-web-helpers/dist/karma-webpack-output.js');
""".trimIndent()
)
}
Expand Down Expand Up @@ -312,7 +313,7 @@ class KotlinKarma(
${
"""
// https://github.com/webpack/webpack/issues/12951
const PatchSourceMapSource = require('kotlin-test-js-runner/webpack-5-debug');
const PatchSourceMapSource = require('kotlin-web-helpers/dist/webpack-5-debug');
config.plugins.push(new PatchSourceMapSource())
"""
}
Expand Down Expand Up @@ -358,7 +359,7 @@ class KotlinKarma(
val file = task.inputFileProperty.getFile()
val fileString = file.toString()

config.files.add(npmProject.require("kotlin-test-js-runner/kotlin-test-karma-runner.js"))
config.files.add(npmProject.require("kotlin-web-helpers/dist/kotlin-test-karma-runner.js"))
if (!debug) {
if (platformType == KotlinPlatformType.wasm) {
val wasmFile = file.parentFile.resolve("${file.nameWithoutExtension}.wasm")
Expand All @@ -375,8 +376,8 @@ class KotlinKarma(
createLoadWasm(npmProject.dir.getFile(), file).normalize().absolutePath
)

config.customContextFile = npmProject.require("kotlin-test-js-runner/static/context.html")
config.customDebugFile = npmProject.require("kotlin-test-js-runner/static/debug.html")
config.customContextFile = npmProject.require("kotlin-web-helpers/dist/static/context.html")
config.customDebugFile = npmProject.require("kotlin-web-helpers/dist/static/debug.html")
} else {
config.files.add(fileString)
}
Expand All @@ -394,7 +395,7 @@ class KotlinKarma(
config.plugins.push('karma-*'); // default
}
config.plugins.push('kotlin-test-js-runner/karma-kotlin-debug-plugin.js');
config.plugins.push('kotlin-web-helpers/dist/karma-kotlin-debug-plugin.js');
""".trimIndent()
)
}
Expand Down Expand Up @@ -470,7 +471,7 @@ class KotlinKarma(
val karmaConfigAbsolutePath = karmaConfJs.absolutePath
val args = if (debug) {
nodeJsArgs + listOf(
npmProject.require("kotlin-test-js-runner/karma-debug-runner.js"),
npmProject.require("kotlin-web-helpers/dist/karma-debug-runner.js"),
karmaConfigAbsolutePath
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class KotlinMocha(@Transient override val compilation: KotlinJsIrCompilation, pr
get() = setOf(
versions.mocha,
versions.sourceMapSupport,
versions.kotlinWebHelpers,
)

override fun getPath() = "$basePath:kotlinMocha"
Expand Down Expand Up @@ -85,8 +86,8 @@ class KotlinMocha(@Transient override val compilation: KotlinJsIrCompilation, pr
add(mocha)
add(file)
addAll(cliArgs.toList())
addAll(cliArg("--reporter", "kotlin-test-js-runner/mocha-kotlin-reporter.js"))
addAll(cliArg("--require", npmProject.require("kotlin-test-js-runner/kotlin-test-nodejs-runner.js")))
addAll(cliArg("--reporter", "kotlin-web-helpers/dist/mocha-kotlin-reporter.js"))
addAll(cliArg("--require", npmProject.require("kotlin-web-helpers/dist/kotlin-test-nodejs-runner.js")))
if (debug) {
add(NO_TIMEOUT_ARG)
} else {
Expand All @@ -104,7 +105,7 @@ class KotlinMocha(@Transient override val compilation: KotlinJsIrCompilation, pr
add(mocha)
add(file)
addAll(cliArgs.toList())
addAll(cliArg("--require", npmProject.require("kotlin-test-js-runner/kotlin-test-nodejs-empty-runner.js")))
addAll(cliArg("--require", npmProject.require("kotlin-web-helpers/dist/kotlin-test-nodejs-empty-runner.js")))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ data class KotlinWebpackConfig(
versions.webpackCli
)

it.add(
versions.kotlinWebHelpers
)

if (sourceMaps) {
it.add(
versions.sourceMapLoader
Expand Down Expand Up @@ -296,7 +300,7 @@ data class KotlinWebpackConfig(
"""
// noinspection JSUnnecessarySemicolon
;(function(config) {
const tcErrorPlugin = require('kotlin-test-js-runner/tc-log-error-webpack');
const tcErrorPlugin = require('kotlin-web-helpers/dist/tc-log-error-webpack');
config.plugins.push(new tcErrorPlugin())
config.stats = config.stats || {}
Object.assign(config.stats, config.stats, {
Expand Down
6 changes: 0 additions & 6 deletions libraries/tools/kotlin-test-js-runner/README.md

This file was deleted.

142 changes: 0 additions & 142 deletions libraries/tools/kotlin-test-js-runner/build.gradle.kts

This file was deleted.

3 changes: 0 additions & 3 deletions libraries/tools/kotlin-test-js-runner/env.ts

This file was deleted.

34 changes: 0 additions & 34 deletions libraries/tools/kotlin-test-js-runner/karma-debug-framework.js

This file was deleted.

Loading

0 comments on commit a838951

Please sign in to comment.