[Gradle, JS] Fix testing of composite build without respect of work of NPM, just look on generated package.json
This commit is contained in:
committed by
Space Team
parent
555d8eeb25
commit
dee3bbb4bf
+12
-11
@@ -96,22 +96,23 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) {
|
|||||||
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
|
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun moduleVersion(rootModulePath: String, moduleName: String, pathToPackageJson: String): String =
|
fun moduleVersion(rootModulePath: String, moduleName: String): String =
|
||||||
NpmProjectModules(projectPath.resolve(rootModulePath).toFile())
|
projectPath.resolve(rootModulePath).toFile()
|
||||||
.require(moduleName)
|
.resolve(NpmProject.PACKAGE_JSON)
|
||||||
.let { Paths.get(it).parent.resolve(pathToPackageJson).resolve(NpmProject.PACKAGE_JSON) }
|
.let { fromSrcPackageJson(it) }
|
||||||
.let { fromSrcPackageJson(it.toFile()) }
|
.let { it?.dependencies }
|
||||||
.let { it!!.version }
|
?.getValue(moduleName)
|
||||||
|
?: error("Not found package $moduleName in $rootModulePath")
|
||||||
|
|
||||||
build("build") {
|
build("build") {
|
||||||
val appAsyncVersion = moduleVersion("build/js/node_modules/js-composite-build", "node-fetch", "..")
|
val libDecamelizeVersion = moduleVersion("build/js/node_modules/lib2", "decamelize")
|
||||||
assertEquals("3.2.8", appAsyncVersion)
|
assertEquals("1.1.1", libDecamelizeVersion)
|
||||||
|
|
||||||
val libAsyncVersion = moduleVersion("build/js/node_modules/lib2", "async", "..")
|
val libAsyncVersion = moduleVersion("build/js/node_modules/lib2", "async")
|
||||||
assertEquals("2.6.2", libAsyncVersion)
|
assertEquals("2.6.2", libAsyncVersion)
|
||||||
|
|
||||||
val appDecamelizeVersion = moduleVersion("build/js/node_modules/base2", "decamelize", ".")
|
val appNodeFetchVersion = moduleVersion("build/js/node_modules/js-composite-build", "node-fetch")
|
||||||
assertEquals("1.1.1", appDecamelizeVersion)
|
assertEquals("3.2.8", appNodeFetchVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user