Skip to content

Commit f6d43b1

Browse files
authored
Fixed save-frontend-common (#2897)
- fixed dependency in task - added karma.config.d/custom-config.js to fix tests
1 parent 32c75ac commit f6d43b1

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

save-frontend-common/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack> {
249249

250250
val distribution: Configuration by configurations.creating
251251
val distributionJarTask by tasks.registering(Jar::class) {
252-
dependsOn(":save-cosv-frontend:browserDistribution")
252+
dependsOn(":save-frontend-common:browserDistribution")
253253
archiveClassifier.set("distribution")
254254
from("$buildDir/$distributionsDirName") {
255255
into("static")
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// https://stackoverflow.com/questions/62826599/what-code-coverage-tool-to-use-for-the-javascript-code-in-a-kotlin-multiplatform
2+
;(function(config) {
3+
const path = require("path")
4+
config.reporters.push("coverage-istanbul")
5+
config.plugins.push("karma-coverage-istanbul-reporter")
6+
config.webpack.module.rules.push(
7+
{
8+
test: /\.js$/,
9+
use: {loader: 'istanbul-instrumenter-loader'},
10+
// fixme: need to exclude Kotlin dependencies
11+
include: [path.resolve(__dirname, '../save-cloud-save-frontend-common/kotlin/')]
12+
}
13+
)
14+
config.coverageIstanbulReporter = {
15+
reports: ["html", "lcov"]
16+
}
17+
}(config));
18+
19+
config.set({
20+
client: {
21+
mocha: {
22+
// completely disable timeout
23+
timeout: 0
24+
}
25+
},
26+
proxies: {
27+
// serving mockServiceWorker.js.js from location relative to base url
28+
// the file should be included into Karma's `files` to be served by server at all
29+
'/mockServiceWorker.js': '/base/mockServiceWorker.js',
30+
},
31+
})
32+
33+
// http://karma-runner.github.io/6.3/config/files.html
34+
// 'All of the relative patterns will get resolved using the basePath first.', where basePath is set by KGP to `node_modules`
35+
config.files.push('./mockServiceWorker.js')

0 commit comments

Comments
 (0)