Remove NPM validation (#3312)
We will drop complete support of NPM as soon as JS IR is declared stable and this test is already a deadweight as it was never run due to misconfiguration
diff --git a/integration-testing/build.gradle b/integration-testing/build.gradle
index 4e025c5..97c9201 100644
--- a/integration-testing/build.gradle
+++ b/integration-testing/build.gradle
@@ -14,11 +14,6 @@
}
sourceSets {
- npmTest {
- kotlin
- compileClasspath += sourceSets.test.runtimeClasspath
- runtimeClasspath += sourceSets.test.runtimeClasspath
- }
mavenTest {
kotlin
compileClasspath += sourceSets.test.runtimeClasspath
@@ -43,20 +38,6 @@
}
}
-task npmTest(type: Test) {
- def sourceSet = sourceSets.npmTest
- environment "projectRoot", project.rootDir
- environment "deployVersion", version
- def dryRunNpm = project.properties['dryRun']
- def doRun = dryRunNpm == "true" // so that we don't accidentally publish anything, especially before the test
- onlyIf { doRun }
- if (doRun) { // `onlyIf` only affects execution of the task, not the dependency subtree
- dependsOn(project(':').getTasksByName("publishNpm", true))
- }
- testClassesDirs = sourceSet.output.classesDirs
- classpath = sourceSet.runtimeClasspath
-}
-
task mavenTest(type: Test) {
environment "version", version
def sourceSet = sourceSets.mavenTest
@@ -96,8 +77,6 @@
dependencies {
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testImplementation 'junit:junit:4.12'
- npmTestImplementation 'org.apache.commons:commons-compress:1.18'
- npmTestImplementation 'com.google.code.gson:gson:2.8.5'
debugAgentTestImplementation project(':kotlinx-coroutines-core')
debugAgentTestImplementation project(':kotlinx-coroutines-debug')
coreAgentTestImplementation project(':kotlinx-coroutines-core')
@@ -108,5 +87,5 @@
}
check {
- dependsOn([npmTest, mavenTest, debugAgentTest, coreAgentTest])
+ dependsOn([mavenTest, debugAgentTest, coreAgentTest])
}
diff --git a/integration-testing/src/npmTest/kotlin/NpmPublicationValidator.kt b/integration-testing/src/npmTest/kotlin/NpmPublicationValidator.kt
deleted file mode 100644
index 8e1b9f9..0000000
--- a/integration-testing/src/npmTest/kotlin/NpmPublicationValidator.kt
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package kotlinx.coroutines.validator
-
-import com.google.gson.*
-import org.apache.commons.compress.archivers.tar.*
-import org.junit.*
-import java.io.*
-import java.util.zip.*
-import org.junit.Assert.*
-
-class NpmPublicationValidator {
- private val VERSION = System.getenv("deployVersion")!!
- private val BUILD_DIR = System.getenv("projectRoot")!!
- private val NPM_ARTIFACT = "$BUILD_DIR/kotlinx-coroutines-core/build/npm/kotlinx-coroutines-core-$VERSION.tgz"
-
- @Test
- fun testPackageJson() {
- println("Checking dependencies of $NPM_ARTIFACT")
- val visited = visit("package.json") {
- val json = JsonParser().parse(content()).asJsonObject
- assertEquals(VERSION, json["version"].asString)
- assertNull(json["dependencies"])
- val peerDependencies = json["peerDependencies"].asJsonObject
- assertEquals(1, peerDependencies.size())
- assertNotNull(peerDependencies["kotlin"])
- }
- assertEquals(1, visited)
- }
-
- @Test
- fun testAtomicfuDependencies() {
- println("Checking contents of $NPM_ARTIFACT")
- val visited = visit(".js") {
- val content = content()
- assertFalse(content, content.contains("atomicfu", true))
- assertFalse(content, content.contains("atomicint", true))
- assertFalse(content, content.contains("atomicboolean", true))
- }
- assertEquals(2, visited)
- }
-
- private fun InputStream.content(): String {
- val bais = ByteArrayOutputStream()
- val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
- var read = read(buffer, 0, DEFAULT_BUFFER_SIZE)
- while (read >= 0) {
- bais.write(buffer, 0, read)
- read = read(buffer, 0, DEFAULT_BUFFER_SIZE)
- }
- return bais.toString()
- }
-
- private inline fun visit(fileSuffix: String, block: InputStream.(entry: TarArchiveEntry) -> Unit): Int {
- var visited = 0
- TarArchiveInputStream(GZIPInputStream(FileInputStream(NPM_ARTIFACT))).use { tais ->
- var entry: TarArchiveEntry? = tais.nextTarEntry ?: return 0
- do {
- if (entry!!.name.endsWith(fileSuffix)) {
- ++visited
- tais.block(entry)
- }
- entry = tais.nextTarEntry
- } while (entry != null)
-
- return visited
- }
- }
-}