所以我只是试图将 chai-as-promised 与 karma 和 webpack 一起使用,这就是我得到的。 我已经安装了 chai-as-promised、karma-chai-as-promised、sinon-chai、karma-sinon-chai、karma-webpack,所以我应该很好,但它在这里不起作用是我的 karma.config 文件
var webpackConfig = require('../../build/webpack.test.conf')
module.exports = function (config) {
config.set({
browsers: ['ChromeHeadless'],
frameworks: ['mocha', 'chai-things', 'sinon-chai', 'chai-as-promised'],
reporters: ['spec', 'coverage'],
files: [
'../../node_modules/babel-polyfill/dist/polyfill.js',
'./index.js'],
preprocessors: {
'./index.js': ['webpack', 'sourcemap']
},
webpack: webpackConfig,
coverageReporter: {
dir: './coverage',
reporters: [
{ type: 'lcov', subdir: '.' },
{ type: 'text-summary' }
]
},
client: {
captureConsole: true
}
})
}