【发布时间】:2016-10-18 20:35:15
【问题描述】:
我有以下 Karma Conf...
var webpackConfig = require('./webpack.config.js');
webpackConfig.entry = {};
webpackConfig.plugins = [];
var globFlat = require('glob-flat');
// TODO: These are redundant with the webpack plugin...
var appFiles = globFlat.sync([
'./src/main/coffee/**/*.coffee'
]);
var styleFiles = globFlat.sync([
]);
var dependencyFiles = [
'test-main.js',
'./src/main/typescripts/**/*.ts',
'node_modules/angular-mocks/angular-mocks.js'
];
var testFiles = globFlat.sync([
'./test/main/webapp/**/*.coffee',
'./test/main/webapp/**/*.js'
]);
var files = dependencyFiles.concat(appFiles, styleFiles, testFiles);
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha', 'requirejs', 'chai-spies', 'chai', 'sinon', 'sinon-chai'],
files: files,
exclude: [ ],
preprocessors: {
'./src/main/coffee/**/*.coffee': ['webpack'],
'./src/main/typescripts/**/*.ts': ['webpack'],
'./test/**/*.coffee': ['coffee']
},
webpack: webpackConfig,
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
concurrency: Infinity
})
};
但是当我运行一些测试时,会出现...
TypeError: expect(...).to.have.been.callWith 不是函数
我不明白,因为我包括了sinon-chai
【问题讨论】:
-
我们可以看看一些测试代码吗?
-
其实我提供的代码已经足够了,我会在一秒钟内给出答案。
标签: sinon chai karma-mocha