Add support for source maps in the karma test framework to aid debugging.

pull/17/head
Ashesh Vashi 2018-05-30 22:09:00 -04:00 committed by Dave Page
parent 38ee39ae7a
commit 86712b1bd2
4 changed files with 38 additions and 5 deletions

View File

@ -1,16 +1,26 @@
// Karma configuration
const webpackConfig = require('./webpack.test.config.js');
const isDocker = require('is-docker')();
const webpack = require('webpack');
module.exports = function (config) {
config.set({
frameworks: ['jasmine'],
frameworks: ['jasmine', 'source-map-support'],
reporters: ['progress', 'kjhtml'],
plugins: [
'karma-webpack',
'karma-chrome-launcher',
'karma-jasmine',
'karma-jasmine-html-reporter',
'karma-source-map-support',
'karma-sourcemap-loader',
new webpack.SourceMapDevToolPlugin({
/*
* filename: null, // if no value is provided the sourcemap is inlined
*/
filename: '[name].js.map',
test: /\.jsx?$/i, // process .js and .jsx files only
}),
],
files: [
'pgadmin/static/bundle/slickgrid.js',
@ -29,9 +39,10 @@ module.exports = function (config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'regression/javascript/**/*.js': ['webpack'],
'regression/javascript/**/*.jsx': ['webpack'],
'pgadmin/static/bundle/slickgrid.js': ['webpack'],
'pgadmin/**/js/**/*.js[x]?': ['sourcemap'],
'regression/javascript/**/*.js': ['webpack', 'sourcemap'],
'regression/javascript/**/*.jsx': ['webpack', 'sourcemap'],
'pgadmin/static/bundle/slickgrid.js': ['webpack', 'sourcemap'],
},
webpack: webpackConfig,

View File

@ -27,6 +27,8 @@
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-requirejs": "~1.1.0",
"karma-source-map-support": "^1.3.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "~2.0.13",
"node-sass": "^4.5.3",
"optimize-css-assets-webpack-plugin": "^2.0.0",

View File

@ -7,6 +7,7 @@ const nodeModulesDir = path.resolve(__dirname, 'node_modules');
const regressionDir = path.resolve(__dirname, 'regression');
module.exports = {
devtool: 'inline-source-map',
plugins: [
new webpack.ProvidePlugin({
jQuery: 'jquery',

View File

@ -5485,6 +5485,18 @@ karma-requirejs@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/karma-requirejs/-/karma-requirejs-1.1.0.tgz#fddae2cb87d7ebc16fb0222893564d7fee578798"
karma-source-map-support@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/karma-source-map-support/-/karma-source-map-support-1.3.0.tgz#36dd4d8ca154b62ace95696236fae37caf0a7dde"
dependencies:
source-map-support "^0.5.5"
karma-sourcemap-loader@^0.3.7:
version "0.3.7"
resolved "https://registry.yarnpkg.com/karma-sourcemap-loader/-/karma-sourcemap-loader-0.3.7.tgz#91322c77f8f13d46fed062b042e1009d4c4505d8"
dependencies:
graceful-fs "^4.1.2"
karma-webpack@~2.0.13:
version "2.0.13"
resolved "https://registry.yarnpkg.com/karma-webpack/-/karma-webpack-2.0.13.tgz#cf56e3056c15b7747a0bb2140fc9a6be41dd9f02"
@ -8495,6 +8507,13 @@ source-map-support@^0.4.15:
dependencies:
source-map "^0.5.6"
source-map-support@^0.5.5:
version "0.5.6"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13"
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"
source-map-url@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
@ -8509,7 +8528,7 @@ source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, sourc
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
source-map@^0.6.1, source-map@~0.6.1:
source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"