[Gradle, JS] Add timeout property
This commit is contained in:
+12
-2
@@ -35,6 +35,9 @@ class KotlinMocha(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
|||||||
versions.mochaTeamCityReporter
|
versions.mochaTeamCityReporter
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// https://mochajs.org/#-timeout-ms-t-ms
|
||||||
|
var timeout: String = DEFAULT_TIMEOUT
|
||||||
|
|
||||||
override fun createTestExecutionSpec(
|
override fun createTestExecutionSpec(
|
||||||
task: KotlinJsTest,
|
task: KotlinJsTest,
|
||||||
forkOptions: ProcessForkOptions,
|
forkOptions: ProcessForkOptions,
|
||||||
@@ -66,8 +69,9 @@ class KotlinMocha(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
|||||||
nodeModules.map {
|
nodeModules.map {
|
||||||
npmProject.require(it)
|
npmProject.require(it)
|
||||||
} + cliArgs.toList() +
|
} + cliArgs.toList() +
|
||||||
listOf("--reporter", "mocha-teamcity-reporter") +
|
cliArg("--reporter", "mocha-teamcity-reporter") +
|
||||||
listOf(
|
cliArg("--timeout", timeout) +
|
||||||
|
cliArg(
|
||||||
"-r", "kotlin-test-js-runner/kotlin-nodejs-source-map-support.js"
|
"-r", "kotlin-test-js-runner/kotlin-nodejs-source-map-support.js"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -79,6 +83,10 @@ class KotlinMocha(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun cliArg(cli: String, value: String?): List<String> {
|
||||||
|
return value?.let { listOf(cli, it) } ?: emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
private fun createAdapterJs(task: KotlinJsTest) {
|
private fun createAdapterJs(task: KotlinJsTest) {
|
||||||
val npmProject = compilation.npmProject
|
val npmProject = compilation.npmProject
|
||||||
val file = task.nodeModulesToLoad
|
val file = task.nodeModulesToLoad
|
||||||
@@ -96,5 +104,7 @@ class KotlinMocha(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val ADAPTER_NODEJS = "adapter-nodejs.js"
|
const val ADAPTER_NODEJS = "adapter-nodejs.js"
|
||||||
|
|
||||||
|
private const val DEFAULT_TIMEOUT = "2s"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user