1
我在ES6中使用angularJS構建項目。保留字'class'與業力和webpack的使用
我正在嘗試配置業力測試賽跑者和伊斯坦布爾的覆蓋範圍。
當我嘗試用勞克噶單元測試,我以下錯誤:
Use of reserved word 'class'
這是我的人緣配置文件:
var path = require('path');
module.exports = function (config) {
config.set({
basePath: '',
plugins: [
'karma-coverage',
'karma-jasmine',
'karma-phantomjs-launcher',
'karma-webpack',
'karma-coverage-istanbul-reporter'
],
frameworks: ['jasmine'],
files: [
'tests/index.js'
],
preprocessors: {
'tests/index.js': 'webpack'
},
webpack: {
module: {
rules: [{
test : /\.js$/,
use : {
loader: 'istanbul-instrumenter-loader',
query : {
esModules: true
}
},
include: path.resolve('src/')
}, {
test: /\.html$/, loaders: ["html-loader"]
}, {
test: /\.less$/,
use : [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "less-loader"
}]
}, {
test : /\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/,
loader: 'url-loader'
}]
}
},
reporters: ['progress', 'coverage-istanbul'],
coverageIstanbulReporter: {
reports : ['text-summary'],
fixWebpackSourcePaths: true
},
port : 9876,
colors : true,
logLevel : config.LOG_INFO,
autoWatch : true,
browsers : ['PhantomJS'],
singleRun : true,
concurrency: Infinity,
})
};
這是我tests/index.js
文件
// requires all tests in `project/test/src/components/**/index.js`
const tests = require.context('./specs/', true, /index\.js$/);
tests.keys().forEach(tests);
// requires all components in `project/src/components/**/index.js`
const components = require.context('../src/', true, /\.js$/);
components.keys().forEach(components);
我錯過了什麼嗎?
謝謝。