我只是安装Karma / Mocha尝试使用React。我得到一个神秘的错误,说这[opt]不是一个函数。不知道该怎么做。
我有以下Karma配置文件:
let webpackConfig = require('./webpack.config.js');
module.exports = function(config) {
config.set({
browsers: ['Chrome'],
singleRun: true,
frameworks: ['mocha'],
files: ['app/tests/**/*.test.jsx'],
preprocessors: {
'app/tests/**/*.test.jsx': ['webpack', 'sourcemap']
},
reporters: ['mocha'],
client: {
mocha: {
timout: '5000'
}
},
webpack: webpackConfig,
webpackServer: {
noInfo: true
}
});
};
用简单的测试:
'use strict'
let expect = require('expect');
describe('App', () => {
it('should properly run tests', () => {
expect(1).toBe(1);
});
});
浏览器从测试开始,但是我收到以下错误:
Chrome 52.0.2743(Mac OS X 10.11.3)错误 未捕获的TypeError:此[opt]不是函数 at /Users/bpr/Documents/ReactTimer/node_modules/mocha/mocha.js:124
答案 0 :(得分:1)
问题在于:
client: {
mocha: {
timout: '5000'
}
}
单词 timout 是一个错字 - 应该超时