KT-62004 Drop legacy JS build of kotlin-test

This commit is contained in:
Ilya Gorbunov
2023-09-16 06:24:51 +02:00
committed by Space Team
parent 291d52820c
commit eb813b7837
13 changed files with 44 additions and 8243 deletions
-1
View File
@@ -1 +0,0 @@
node_modules
-105
View File
@@ -1,105 +0,0 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute
plugins {
id "com.github.node-gradle.node" version "5.0.0"
}
description = 'Kotlin-test integration tests for JS'
apply plugin: 'kotlin-platform-js'
configurations {
nodeModules {
extendsFrom api
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY))
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, KotlinUsages.KOTLIN_RUNTIME))
attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.legacy)
}
}
[compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath].forEach {
it.attributes {
attribute(org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute.jsCompilerAttribute, org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute.legacy)
}
}
}
dependencies {
api project(':kotlin-test:kotlin-test-js')
}
// package.json contains direct links to the builddir
buildDir = "$projectDir/build"
["compileKotlin2Js", "compileTestKotlin2Js"].forEach {
tasks.named(it).configure {
kotlinOptions {
moduleKind = "commonjs"
freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
}
}
tasks.register("populateNodeModules", Copy) {
dependsOn(compileKotlin2Js)
dependsOn(configurations.nodeModules)
from compileKotlin2Js.destinationDirectory
duplicatesStrategy = DuplicatesStrategy.EXCLUDE // temporary until stdlib mpp migration is completed
from {
configurations.nodeModules.collect {
// WORKAROUND: Some JS IR jars were absent and caused this task to fail.
// They don't contain .js thus we can skip them.
if (it.exists()) {
zipTree(it.absolutePath).matching { include '*.js' }
}
}
}
into "${buildDir}/node_modules"
}
node {
version = RepoDependencies.getNodejsVersion(project)
download = true
}
def createFrameworkTest(def name) {
return tasks.register("test$name", NpmTask) {
dependsOn(compileTestKotlin2Js, populateNodeModules, npmInstall)
def testName = name
def lowerName = name.toLowerCase()
def tcOutput = project.file("$buildDir/tc-${lowerName}.log")
def stdOutput = "$buildDir/test-${lowerName}.log"
def errOutput = "$buildDir/test-${lowerName}.err.log"
def exitCodeFile = project.file("$buildDir/test-${lowerName}.exit-code")
inputs.files(sourceSets.test.output)
inputs.dir("${buildDir}/node_modules")
outputs.files(tcOutput, stdOutput, errOutput, exitCodeFile)
args = ['run', "test-$lowerName"]
group = 'verification'
execOverrides {
it.ignoreExitValue = true
it.standardOutput = new FileOutputStream(stdOutput)
it.errorOutput = new FileOutputStream(errOutput)
}
def ignoreTestFailures = rootProject.ignoreTestFailures
doLast {
println tcOutput.text
if (exitCodeFile.text != "0" && !ignoreTestFailures) {
throw new GradleException("$testName integration test failed")
}
}
}
}
tasks.check {
['Jest', 'Jasmine', 'Mocha', 'Qunit', 'Tape'].each {
dependsOn createFrameworkTest(it)
}
}
File diff suppressed because it is too large Load Diff
-20
View File
@@ -1,20 +0,0 @@
{
"scripts": {
"test-jasmine": "jasmine js/jasmine-reporter.js build/classes/kotlin/test/kotlin-test-js-it_test.js",
"test-jest": "jest",
"test-mocha": "mocha --reporter js/mocha-reporter.js build/classes/kotlin/test/kotlin-test-js-it_test.js",
"test-qunit": "qunit --require ./js/qunit-reporter.js build/classes/kotlin/test/kotlin-test-js-it_test.js",
"test-tape": "tape js/tape-reporter.js js/tape-plugin.js build/classes/kotlin/test/kotlin-test-js-it_test.js"
},
"devDependencies": {
"jasmine": "^3.10.0",
"jest": "^29.5.0",
"mocha": "^9.2.1",
"qunit": "^2.18.2",
"tape": "~4.10.0"
},
"jest": {
"testResultsProcessor": "<rootDir>/js/jest-reporter.js",
"testRegex": "_test\\.js$"
}
}