1
使用因緣+巴貝爾+的WebPack運行ES6單元測試。我使用webpack軟件包來定位和傳輸ES6。它所有的工作,但每當有任何測試文件,我得到任何跡象表明那裏產生錯誤信息的錯誤,像跟蹤誤差使用因緣+巴別+的WebPack與束
Uncaught TypeError: Cannot read property 'querySelector' of null
at /pth/to/test.bundle.js:13256
這總是/pth/to/test.bundle.js:xxxx
。任何想法如何讓它顯示更有用的消息?
這裏是我的配置
module.exports = function(config) {
config.set({
browsers: ["Chrome"],
files: [
{
pattern: "test.bundle.js",
watched: false
}],
frameworks: ["jasmine-jquery", "jasmine-ajax", "jasmine"],
preprocessors: {,
"test.bundle.js": ["webpack"]
},
reporters: ["dots"],
singleRun: false,
webpack: {
module: {
loaders: [{
test: /\.js/,
exclude: /node_modules/,
loader: "babel-loader?cacheDirectory&optional[]=runtime"
}]
},
watch: true
},
webpackServer: {
noInfo: true
}
});
};
而且我test.bundle.js
var context = require.context("./src", true, /.+(-helpers|\.test)\.js$/);
context.keys().forEach(context);
對不起,對於最近的答覆 - 輝煌,工程,謝謝! – gotofritz