1
1
plugins {
2
- id ' com.craigburke.karma ' version ' 1.4.4 '
2
+ id " com.moowork.node " version " 1.2.0 "
3
3
}
4
4
5
5
description = ' Kotlin Standard Library for JS'
@@ -162,7 +162,7 @@ compileExperimentalKotlin2Js {
162
162
compileTestKotlin2Js {
163
163
dependsOn preprocessSourcesTest
164
164
kotlinOptions {
165
- moduleKind = " plain "
165
+ moduleKind = " umd "
166
166
}
167
167
}
168
168
@@ -301,33 +301,39 @@ dist {
301
301
}
302
302
}
303
303
304
+ task populateNodeModules (type : Copy , dependsOn : [compileJs, compileTestKotlin2Js]) {
305
+ from jsOutputFile
306
+ from kotlinTestJsOutputFile
304
307
305
- karma {
306
-
308
+ into " ${ buildDir } /node_modules "
309
+ }
307
310
308
- frameworks = [' qunit' ]
309
- browsers = [' PhantomJS' ]
311
+ node {
312
+ download = true
313
+ version = ' 8.9.4' // The default 6.9.1 has buggy hyperbolic functions implementation
314
+ nodeModulesDir = buildDir
315
+ }
310
316
311
- if (project . hasProperty( " teamcity " ) ) {
312
- reporters = [' teamcity ' ]
313
- }
317
+ task installMocha ( type : NpmTask , dependsOn : [populateNodeModules] ) {
318
+ args = [' install ' , ' mocha ' ]
319
+ }
314
320
315
- profile(' default' ) {
316
- libraryBases = [' ' ]
317
- libraryFiles = [jsOutputFile, kotlinTestJsOutputFile]
321
+ task installTeamcityReporter (type : NpmTask , dependsOn : [populateNodeModules]) {
322
+ args = [' install' , ' mocha-teamcity-reporter' ]
323
+ }
324
+
325
+ task runMocha (type : NodeTask , dependsOn : [compileTestKotlin2Js, populateNodeModules, installMocha]) {
326
+ script = file(" ${ buildDir} /node_modules/mocha/bin/mocha" )
327
+ args = [jsTestOutputFile]
318
328
319
- sourceBases = []
320
- sourceFiles = []
329
+ if (project. hasProperty(" teamcity" )) {
330
+ dependsOn installTeamcityReporter
331
+ args = [' --reporter' , ' mocha-teamcity-reporter' ] + args
321
332
322
- testBases = [' ' ]
323
- testFiles = [jsTestOutputFile, kotlinTestJsTestOutputFile]
333
+ execOverrides {
334
+ it. ignoreExitValue = true
335
+ }
324
336
}
325
337
}
326
338
327
- karmaGenerateConfig. outputs. upToDateWhen { false }
328
- karmaRun {
329
- ignoreExitValue = Boolean . valueOf(ignoreTestFailures)
330
- dependsOn testClasses
331
- dependsOn tasks. getByPath(' :kotlin-test:kotlin-test-js:testClasses' )
332
- }
333
- clean. dependsOn karmaClean
339
+ test. dependsOn runMocha
0 commit comments