Update karma and webpack config

This commit is contained in:
Bartek Fabiszewski 2019-12-19 23:04:12 +01:00
parent 01d86aa6dd
commit a38171cf2d
5 changed files with 918 additions and 712 deletions

View File

@ -3,36 +3,40 @@
process = require('process');
process.env.CHROME_BIN = require('puppeteer').executablePath();
const preprocessors = {};
const reporters = [ 'progress' ];
const path = require('path');
// don't preprocess files on debug run
if (!process.env._INTELLIJ_KARMA_INTERNAL_PARAMETER_debug && !process.argv.includes('--debug')) {
preprocessors['src/**/*.js'] = 'karma-coverage-istanbul-instrumenter';
reporters.push('coverage-istanbul');
}
// if (!process.env._INTELLIJ_KARMA_INTERNAL_PARAMETER_debug && !process.argv.includes('--debug')) {
// reporters.push('coverage-istanbul');
// }
module.exports = function(config) {
config.set({
basePath: 'js/',
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: [ 'jasmine' ],
// list of files / patterns to load in the browser
files: [
{ pattern: 'test/*.test.js', type: 'module' },
{ pattern: 'test/*.stub.js', type: 'module', included: false },
{ pattern: 'src/**/*.js', type: 'module', included: false },
{ pattern: 'test/openlayers.bundle.js', type: 'js', included: true }
{ pattern: 'test/helpers/*.js', type: 'module', included: false },
{ pattern: 'test/openlayers.bundle.js', type: 'js', included: true },
{ pattern: 'src/**/*.js', type: 'module', included: false }
],
// list of files / patterns to exclude
exclude: [],
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: preprocessors,
coverageIstanbulInstrumenter: {
esModules: true
preprocessors: {
'test/*.test.js': [ 'webpack', 'sourcemap' ],
'test/helpers/*.js': [ 'webpack', 'sourcemap' ],
'src/**/*.js': [ 'sourcemap' ]
},
coverageIstanbulReporter: {
reports: [ 'html', 'text-summary', 'lcovonly' ],
dir: path.join(__dirname, 'coverage'),
fixWebpackSourcePaths: true,
'report-config': {
html: { outdir: 'html' }
}
},
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: reporters,
reporters: [ 'progress', 'coverage-istanbul' ],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
@ -48,6 +52,27 @@ module.exports = function(config) {
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// how many browser should be started simultaneous
concurrency: Infinity
concurrency: Infinity,
// webpack
webpack: {
mode: 'development',
devtool: 'inline-source-map',
watch: true,
module: {
rules: [
{
test: /\.js$/,
include: path.resolve('js/src/'),
use: {
loader: 'istanbul-instrumenter-loader',
options: { esModules: true }
}
}
]
}
},
webpackMiddleware: {
noInfo: true
}
})
};

1507
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,33 +15,37 @@
"author": "Bartek Fabiszewski",
"license": "GPL-3.0-or-later",
"devDependencies": {
"@babel/cli": "^7.7.4",
"@babel/core": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.4",
"@babel/preset-env": "^7.7.4",
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.6",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"browserlist": "^1.0.1",
"clean-webpack-plugin": "^3.0.0",
"core-js": "^3.4.2",
"eslint": "^6.7.1",
"eslint-plugin-import": "^2.18.2",
"core-js": "^3.5.0",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-jasmine": "^4.1.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine": "^3.5.0",
"karma": "^4.4.1",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage-istanbul-instrumenter": "^1.0.1",
"karma-coverage-istanbul-reporter": "^2.1.1",
"karma-jasmine": "^2.0.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^4.0.2",
"puppeteer": "^2.0.0",
"regenerator-runtime": "^0.13.3",
"webpack": "^4.41.2",
"webpack": "^4.41.3",
"webpack-cli": "^3.3.10",
"webpack-merge": "^4.2.2"
},
"dependencies": {
"@babel/runtime": "^7.7.4",
"babel-runtime": "^6.26.0",
"@babel/runtime": "^7.7.6",
"chartist": "^0.11.4",
"chartist-plugin-axistitle": "0.0.4",
"ol": "^6.1.1"
},
"browserslist": [

View File

@ -1,27 +0,0 @@
const path = require('path');
const MinifyPlugin = require('babel-minify-webpack-plugin');
module.exports = {
mode: 'production',
entry: './js/ulogger.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'js')
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
plugins: [
new MinifyPlugin()
]
};

View File

@ -3,6 +3,7 @@ const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
module: {
rules: [
{