2016-11-08 46 views
0

我創建了一個簡單的Webpack + Typescript + Karma應用程序,但我無法使代碼覆蓋範圍正常工作。每一樣this和其他信息提供項目here你可以看到我試過......如何將代碼覆蓋範圍添加到Typescript + Webpack + Karma w/Istanbul-Instrumenter

// In test bundle 
const componentsContext = require.context('../src/', true, /\.js$/); 
componentsContext.keys().forEach(componentsContext); 

// In webpack config 
const helpers = require('./helpers.js') 
const webpackMerge = require('webpack-merge'); // used to merge webpack configs 
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev 
const HtmlWebpackPlugin = require('html-webpack-plugin'); 
module.exports = function() { 
    return webpackMerge(commonConfig(), { 
    devtool: 'inline-source-map', 
    output: { 
     path: helpers.root("dist"), 
     filename: '[name].bundle.js', 
    }, 
    module: { 
     postLoaders: [ 
     { 
      test: /^((?!\.spec\.ts).)*.ts$/, 
      exclude: /(node_modules|bower_components)/, 
      loader: 'istanbul-instrumenter' 
     } 
     ] 
    } 
    }) 
}; 

但是當我運行karma start test/karma.conf.js我看100%,沒有列出的文件。我錯過了什麼?

回答