I have the following configuration:
karma.conf.js
var webpack = require('./webpack/webpack.dev');
var port = process.env['KARMA_PORT'] || '9876';
module.exports = (config) => {
config.set({
basePath: '',
frameworks: ['modules', 'jasmine'],
files: [
'src/**/*.ts'
],
exclude: [],
preprocessors: {
'src/**/*.ts': ['webpack', 'sourcemap']
},
webpack: webpack,
webpack.dev.js
devtool: 'inline-source-map',
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: null, // if no value is provided the sourcemap is inlined
test: /\.(ts|js)($|\?)/i // process .js and .ts files only
})
],
loaders: [{
test: /\.ts$/,
include: path.resolve('./src'),
exclude: /node_modules/,
use: [
'awesome-typescript-loader'
]
},
tsconfig.json
{
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true,
"transpileOnly": false
},
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"inlineSourceMap": true,
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"lib": [
"dom",
"es2015"
],
"types" : [
"jquery",
"jasmine",
"angular-mocks",
"angular-animate",
"node"
],
"typeRoots": [
"node_modules/@types",
"./node_modules",
"./typings/global.d.ts"
]
},
"files": [
"typings/global.d.ts",
"src/some/index.ts"
],
"include": [
"./typings/**/*.ts"
],
"exclude": [
"node_modules"
]
}
With this configuration coverage its working properly: remap-instabul remaps code correctly but when i try to debug unit tests in Chrome - source maps are broken. If i set in tsconfig.json sourceMaps: true and inlineSourceMaps: false - source maps will work fine in Chrome but coverage will be broken :(
What is the correct configuration in order to have source maps working in unit tests and in coverage both?