diff --git a/build.gradle b/build.gradle index 04b320b..9f6b230 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,6 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}" classpath "org.jetbrains.kotlin:kotlin-serialization:${kotlinVersion}" classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:${frontendPluginVersion}" -// classpath "net.devrieze:xmlutil-serialization:0.12.0.0" } } @@ -28,7 +27,6 @@ if (production) { } apply plugin: 'org.jetbrains.kotlin.frontend' apply plugin: 'kotlinx-serialization' -//apply plugin: 'xmlutil-serialization-js' repositories { maven { url = "http://bintray.com/" } @@ -58,14 +56,13 @@ dependencies { compile "pl.treksoft:kvision-moment:${kvisionVersion}" compile "pl.treksoft:kvision-tabulator:${kvisionVersion}" testCompile "org.jetbrains.kotlin:kotlin-test-js:${kotlinVersion}" -// compile "net.devrieze:xmlutil-serialization:0.12.0.0" } kotlinFrontend { - sourceMaps = true // CHANGE HERE + sourceMaps = true webpackBundle { bundleName = "main" - sourceMapEnabled = false // CHANGE HERE (it must be false!) + sourceMapEnabled = false contentPath = file('src/main/web') mode = production ? "production" : "development" } @@ -78,7 +75,7 @@ compileKotlin2Js { outputFile = "$project.buildDir.path/js/${project.name}.js" sourceMap = !production sourceMapEmbedSources = "always" - moduleKind = 'umd' + moduleKind = 'commonjs' } } @@ -88,7 +85,7 @@ compileTestKotlin2Js { outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js" sourceMap = !production sourceMapEmbedSources = "always" - moduleKind = 'umd' + moduleKind = 'commonjs' } } @@ -96,17 +93,9 @@ task pot(type: GruntTask) { args = ["pot"] } -task po2json(type: GruntTask) { - args = ["default"] - inputs.dir(file('translation')) - outputs.dir(file('build/js')) - outputs.dir(file('build/kotlin-js-min/main')) -} - pot.dependsOn 'installGrunt' pot.dependsOn 'npmInstall' -po2json.dependsOn 'installGrunt' -po2json.dependsOn 'npmInstall' + task copyResources(type: Copy) { from "src/main/resources" @@ -147,8 +136,8 @@ afterEvaluate { tasks.getByName("copyResourcesForDce") { dependsOn(runDceKotlinJs) } } tasks.getByName("webpack-bundle") { - dependsOn(/*po2json,*/ copyResources, copyResourcesForDce) + dependsOn(copyResources, copyResourcesForDce) } - tasks.getByName("webpack-run") { dependsOn(/*po2json,*/ copyResources) } - tasks.getByName("karma-start") { dependsOn(/*po2json,*/ copyResources) } + tasks.getByName("webpack-run") { dependsOn(copyResources) } + tasks.getByName("karma-start") { dependsOn(copyResources) } } diff --git a/gradle.properties b/gradle.properties index cb4380d..c692834 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,3 @@ kotlinVersion=1.3.50 kvisionVersion=1.0.0 serializationVersion=0.11.0 frontendPluginVersion=0.0.45 -kotlin.incremental.js=false -#kotlin.parallel.tasks.in.project=true -systemProp.sonar.host.url=http://localhost:9000 -systemProp.sonar.login=a3d5c3d3fd7ec307158740001e8c04c3f437ff93 diff --git a/karma.conf.js b/karma.conf.js index b38aba8..cc79baa 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,68 +1,34 @@ -// see https://github.com/mkraynov/kfsad/blob/master/karma.conf.js +// Example: see https://github.com/mkraynov/kfsad/blob/master/karma.conf.js +// Doc: see http://karma-runner.github.io/4.0/config/configuration-file.html module.exports = function (config) { config.set({ - basePath: '', - // all plugins have to be installed before via - // npm install --save-dev - plugins: [ - 'karma-webpack', - 'karma-browserify', - 'karma-jasmine', - 'karma-mocha', - 'karma-mocha-reporter', - 'karma-chrome-launcher', - 'karma-phantomjs-launcher', - 'karma-coverage'], - frameworks: ['mocha'], - files: [ - 'build/js-tests/kroviz-tests.js' - ], - exclude: [], - preprocessors: { - 'build/**/*_test.js': ['webpack'] - }, -// webpack: require('./webpack.karma'), - webpack: { - entry: './build/js-tests/kroviz-tests.js', - output: { - filename: 'bundle.js' - } - }, - webpackMiddleware: { - noInfo: true - }, - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['coverage'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['ChromeHeadlessNoSandbox'], - customLaunchers: { - // https://github.com/karma-runner/karma-chrome-launcher/issues/158#issuecomment-339265457 - ChromeHeadlessNoSandbox: { - base: 'ChromeHeadless', - flags: ['--no-sandbox'] - } - }, - singleRun: true, - concurrency: Infinity, - client: { - mocha: { - timeout: 6000 - } - } + files: ['./build/**/*.js'], + excludes: ['./**/*.css'], + preprocessors: { +// 'build/**/*_test.js': ['webpack'] + }, + frameworks: ['jasmine'], + plugins: [ + require('karma-chrome-launcher'), + require('karma-coverage-istanbul-reporter'), + require('istanbul-instrumenter-loader'), + require('karma-jasmine'), + require('karma-jasmine-html-reporter'), + require('karma-webpack') + ], + reporters: ['coverage-istanbul'], + coverageIstanbulReporter: { + reports: ['html', 'lcovonly', 'text-summary'], + // if using webpack and pre-loaders, work around webpack breaking the source path + fixWebpackSourcePaths: true + }, + browsers: ['ChromeHeadless'], - /* plugins: [ - 'karma-browserify', - 'karma-mocha', - 'karma-mocha-reporter', - 'karma-chrome-launcher', - 'karma-phantomjs-launcher', - 'karma-coverage'], - browserify: ({ - entries: ['./build/js/kroviz.js'], */ -// noParse: ['./node_modules_imported/**/*js'] -// }), - }) +// logLevel: config.LOG_DEBUG, + autoWatch: true, + singleRun: true, + concurrency: Infinity, + color: false + } + ) }; diff --git a/package.json b/package.json index 33aedd5..3ba673a 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,8 @@ "dependencies": { "default-passive-events": "^1.0.10", "grunt-cli": "^1.3.2", + "istanbul-instrumenter-loader": "^3.0.1", + "karma-coverage-istanbul-reporter": "^2.1.0", "karma-jasmine-html-reporter": "^1.4.2", "kotlinx-serialization-runtime-js": "^0.5.0", "progress": "^2.0.3",