Permalink
Browse files

feat(sourcemaps): inlcude sourcemaps in karma configuration

add the bundle source maps to karma files configuration and add inline source maps to transpiler options so unit tests also have source maps.

closes aurelia/cli#420
  • Loading branch information...
simonfox committed Jun 16, 2017
1 parent cc65ec9 commit ebd79e8824ffdd4b87f51c314b0c49d6d288f434
@@ -23,7 +23,8 @@ module.exports = function(project) {
'jasmine-core',
'karma',
'karma-chrome-launcher',
'karma-jasmine'
'karma-jasmine',
'karma-sourcemap-loader'
);
if (project.model.transpiler.id === 'babel') {
View
@@ -43,6 +43,7 @@
"karma-jasmine": "^1.0.2",
"karma-babel-preprocessor": "^6.0.1",
"karma-typescript-preprocessor": "^0.2.1",
"karma-sourcemap-loader": "^0.3.7",
"minimatch": "^3.0.2",
"requirejs": "^2.3.2",
"text": "github:requirejs/text#latest",
@@ -11,7 +11,11 @@ let output = project.platform.output;
let appSrc = project.build.bundles.map(x => path.join(output, x.name));
let entryIndex = appSrc.indexOf(path.join(output, project.build.loader.configTarget));
let entryBundle = appSrc.splice(entryIndex, 1)[0];
let files = [entryBundle].concat(testSrc).concat(appSrc);
let sourceMaps = [{pattern:'scripts/**/*.js.map', included: false}];
let files = [entryBundle].concat(testSrc).concat(appSrc).concat(sourceMaps);
let transpilerOptions = project.transpiler.options;
transpilerOptions.sourceMap = 'inline';
module.exports = function(config) {
config.set({
@@ -20,9 +24,10 @@ module.exports = function(config) {
files: files,
exclude: [],
preprocessors: {
[project.unitTestRunner.source]: [project.transpiler.id]
[project.unitTestRunner.source]: [project.transpiler.id],
[appSrc]: ['sourcemap']
},
'babelPreprocessor': { options: project.transpiler.options },
'babelPreprocessor': { options: transpilerOptions },
reporters: ['progress'],
port: 9876,
colors: true,
@@ -12,7 +12,12 @@ let output = project.platform.output;
let appSrc = project.build.bundles.map(x => path.join(output, x.name));
let entryIndex = appSrc.indexOf(path.join(output, project.build.loader.configTarget));
let entryBundle = appSrc.splice(entryIndex, 1)[0];
let files = [entryBundle].concat(testSrc).concat(appSrc);
let sourceMaps = [{pattern:'scripts/**/*.js.map', included: false}];
let files = [entryBundle].concat(testSrc).concat(appSrc).concat(sourceMaps);
let compilerOptions = tsconfig.compilerOptions;
compilerOptions.inlineSourceMap = true;
compilerOptions.inlineSources = true;
module.exports = function(config) {
config.set({
@@ -21,11 +26,12 @@ module.exports = function(config) {
files: files,
exclude: [],
preprocessors: {
[project.unitTestRunner.source]: [project.transpiler.id]
[project.unitTestRunner.source]: [project.transpiler.id],
[appSrc]: ['sourcemap']
},
typescriptPreprocessor: {
typescript: require('typescript'),
options: tsconfig.compilerOptions
options: compilerOptions
},
reporters: ['progress'],
port: 9876,

0 comments on commit ebd79e8

Please sign in to comment.