在业力和Jasmine测试框架的代码覆盖范围内,如何忽略文件?
包装未使用角度cli。
我在业力配置中尝试了exclude
选项,它不起作用。
仪器加载器也正在工作。出现以下错误。使用babel loader尝试,但没有运气。
模块构建失败:SyntaxError:“ import”和“ export”可能仅与“ sourceType:“ module”“(1:0)一起出现
有什么好的选择吗?
是否需要更改Webpack?
const webpackConfig = require('../webpack/webpack.test');
const dirs = require('../dirs');
module.exports = function (config) {
const _config = {
frameworks: ['jasmine','karma-typescript'],
plugins: [
'karma-jasmine',
'karma-phantomjs-launcher',
'karma-webpack',
'karma-sourcemap-loader',
'karma-typescript',
'karma-coverage',
],
files: [
{ pattern: 'karma-entry.js', watched: false },
],
preprocessors: {
'karma-entry.js': ['webpack', 'sourcemap','coverage'],
},
webpack: webpackConfig,
webpackServer: {
noInfo: true
},
reporters: ['progress','coverage'],
singleRun: true,
port: 9876,
logLevel: config.LOG_DEBUG,
autoWatch: false,
browsers: ['PhantomJS'],
coverageReporter: {
dir: 'coverage/',
reporters: [
{ type: "html", subdir: "html" },
{ type: 'text-summary' }
]
}
};
config.set(_config);
};
webpack-test.js
const path = require('path');
const webpack = require('webpack');
const dirs = require('../dirs');
module.exports = {
devtool: 'inline-source-map',
resolve: {
root: dirs.SRC_ROOT,
extensions: ['', '.ts', '.js', '.json', '.css', '.scss', '.html'],
},
module: {
loaders: [
{
test: /\.ts$/,
loader: 'ts!angular2-template',
exclude: [/node_modules/,/configuration/,/build/],
},
{
},
{
test: /\.html$/,
loader: 'raw',
},
{
test: /\.css$/,
loader: 'raw',
},
],
},
};