Skip to content

Commit dee3bbb

Browse files
ilgonmicSpace Team
authored and
Space Team
committed
[Gradle, JS] Fix testing of composite build without respect of work of NPM, just look on generated package.json
1 parent 555d8ee commit dee3bbb

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt

+12-11
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,23 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) {
9696
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
9797
}
9898

99-
fun moduleVersion(rootModulePath: String, moduleName: String, pathToPackageJson: String): String =
100-
NpmProjectModules(projectPath.resolve(rootModulePath).toFile())
101-
.require(moduleName)
102-
.let { Paths.get(it).parent.resolve(pathToPackageJson).resolve(NpmProject.PACKAGE_JSON) }
103-
.let { fromSrcPackageJson(it.toFile()) }
104-
.let { it!!.version }
99+
fun moduleVersion(rootModulePath: String, moduleName: String): String =
100+
projectPath.resolve(rootModulePath).toFile()
101+
.resolve(NpmProject.PACKAGE_JSON)
102+
.let { fromSrcPackageJson(it) }
103+
.let { it?.dependencies }
104+
?.getValue(moduleName)
105+
?: error("Not found package $moduleName in $rootModulePath")
105106

106107
build("build") {
107-
val appAsyncVersion = moduleVersion("build/js/node_modules/js-composite-build", "node-fetch", "..")
108-
assertEquals("3.2.8", appAsyncVersion)
108+
val libDecamelizeVersion = moduleVersion("build/js/node_modules/lib2", "decamelize")
109+
assertEquals("1.1.1", libDecamelizeVersion)
109110

110-
val libAsyncVersion = moduleVersion("build/js/node_modules/lib2", "async", "..")
111+
val libAsyncVersion = moduleVersion("build/js/node_modules/lib2", "async")
111112
assertEquals("2.6.2", libAsyncVersion)
112113

113-
val appDecamelizeVersion = moduleVersion("build/js/node_modules/base2", "decamelize", ".")
114-
assertEquals("1.1.1", appDecamelizeVersion)
114+
val appNodeFetchVersion = moduleVersion("build/js/node_modules/js-composite-build", "node-fetch")
115+
assertEquals("3.2.8", appNodeFetchVersion)
115116
}
116117
}
117118
}

0 commit comments

Comments
 (0)