我创建了一个简单的Webpack + Typescript + Karma应用程序,但我无法让代码覆盖率正常工作。对于像这样的项目和此处提供的其他信息,您可以看到我尝试过...
// 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% 并且没有列出任何文件。我错过了什么?