@@ -12,16 +12,24 @@ task installDependenciesMochaNode(type: NpmTask, dependsOn: [npmInstall]) {
12
12
if (project. hasProperty(" teamcity" )) args + = [" mocha-teamcity-reporter@$mocha_teamcity_reporter_version " ]
13
13
}
14
14
15
+ def compileJsLegacy = tasks. hasProperty(" compileKotlinJsLegacy" )
16
+ ? compileKotlinJsLegacy
17
+ : compileKotlinJs
18
+
19
+ def compileTestJsLegacy = tasks. hasProperty(" compileTestKotlinJsLegacy" )
20
+ ? compileTestKotlinJsLegacy
21
+ : compileTestKotlinJs
22
+
15
23
// todo: use atomicfu-transformed test files here (not critical)
16
- task testMochaNode (type : NodeTask , dependsOn : [compileTestKotlinJs , installDependenciesMochaNode]) {
24
+ task testMochaNode (type : NodeTask , dependsOn : [compileTestJsLegacy , installDependenciesMochaNode]) {
17
25
script = file(" $node . nodeModulesDir /node_modules/mocha/bin/mocha" )
18
- args = [compileTestKotlinJs . outputFile, ' --require' , ' source-map-support/register' ]
26
+ args = [compileTestJsLegacy . outputFile, ' --require' , ' source-map-support/register' ]
19
27
if (project. hasProperty(" teamcity" )) args + = [' --reporter' , ' mocha-teamcity-reporter' ]
20
28
}
21
29
22
- def legacyjsTestTask = project. tasks. findByName(' legacyjsTest ' ) ? legacyjsTest : jsTest
30
+ def jsLegacyTestTask = project. tasks. findByName(' jsLegacyTest ' ) ? jsLegacyTest : jsTest
23
31
24
- legacyjsTestTask . dependsOn testMochaNode
32
+ jsLegacyTestTask . dependsOn testMochaNode
25
33
26
34
// -- Testing with Mocha under headless Chrome
27
35
@@ -38,7 +46,7 @@ task installDependenciesMochaChrome(type: NpmTask, dependsOn: [npmInstall]) {
38
46
39
47
def mochaChromeTestPage = file(" $buildDir /test-page.html" )
40
48
41
- task prepareMochaChrome (dependsOn : [compileTestKotlinJs , installDependenciesMochaChrome]) {
49
+ task prepareMochaChrome (dependsOn : [compileTestJsLegacy , installDependenciesMochaChrome]) {
42
50
outputs. file(mochaChromeTestPage)
43
51
}
44
52
@@ -56,8 +64,8 @@ prepareMochaChrome.doLast {
56
64
<script>mocha.setup('bdd');</script>
57
65
<script src="$node . nodeModulesDir /node_modules/kotlin/kotlin.js"></script>
58
66
<script src="$node . nodeModulesDir /node_modules/kotlin-test/kotlin-test.js"></script>
59
- <script src="$c ompileKotlinJs . outputFile "></script>
60
- <script src="$c ompileTestKotlinJs . outputFile "></script>
67
+ <script src="$c ompileJsLegacy . outputFile "></script>
68
+ <script src="$c ompileTestJsLegacy . outputFile "></script>
61
69
<script>mocha.run();</script>
62
70
</body>
63
71
</html>
@@ -66,7 +74,7 @@ prepareMochaChrome.doLast {
66
74
67
75
task testMochaChrome (type : NodeTask , dependsOn : prepareMochaChrome) {
68
76
script = file(" $node . nodeModulesDir /node_modules/mocha-headless-chrome/bin/start" )
69
- args = [compileTestKotlinJs . outputFile, ' --file' , mochaChromeTestPage]
77
+ args = [compileTestJsLegacy . outputFile, ' --file' , mochaChromeTestPage]
70
78
if (project. hasProperty(" teamcity" )) args + = [' --reporter' , ' mocha-teamcity-reporter' ]
71
79
}
72
80
@@ -85,11 +93,11 @@ task installDependenciesMochaJsdom(type: NpmTask, dependsOn: [npmInstall]) {
85
93
if (project. hasProperty(" teamcity" )) args + = [" mocha-teamcity-reporter@$mocha_teamcity_reporter_version " ]
86
94
}
87
95
88
- task testMochaJsdom (type : NodeTask , dependsOn : [compileTestKotlinJs , installDependenciesMochaJsdom]) {
96
+ task testMochaJsdom (type : NodeTask , dependsOn : [compileTestJsLegacy , installDependenciesMochaJsdom]) {
89
97
script = file(" $node . nodeModulesDir /node_modules/mocha/bin/mocha" )
90
- args = [compileTestKotlinJs . outputFile, ' --require' , ' source-map-support/register' , ' --require' , ' jsdom-global/register' ]
98
+ args = [compileTestJsLegacy . outputFile, ' --require' , ' source-map-support/register' , ' --require' , ' jsdom-global/register' ]
91
99
if (project. hasProperty(" teamcity" )) args + = [' --reporter' , ' mocha-teamcity-reporter' ]
92
100
}
93
101
94
- legacyjsTestTask . dependsOn testMochaJsdom
102
+ jsLegacyTestTask . dependsOn testMochaJsdom
95
103
0 commit comments