业力给我一个 __karma__.start 适配器错误,没有任何其他错误

Karma gives me a __karma__.start adapter error without any other error

我不知道如何解决这个问题。除了上述错误外,我没有收到其他错误。这是我的配置文件:

./webpack.config.js

var path = require('path');
var webpack = require('webpack');

module.exports = {
  entry: './src/app/app.jsx',
  output: { path: __dirname, filename: 'app.js' },
  port: 9090,
  devServer: {
    contentBase: './src',
    hot: true,
    port: 9090,
    publicPath: '/assets/',
    noInfo: false
  },
  resolve: ['.js', '.jsx', ''],
  module: {
    loaders: [
      {
        test: /.jsx$/,
        loader: 'babel-loader',
        exclude: /node_modules/,
        query: {
          presets: ['es2015', 'react']
        }
      }
    ]
  },
};

./karma.conf.js

var webpackConfig = require('./webpack.config');
webpackConfig.devtool = 'inline-source-map';

module.exports = function(config) {
  config.set({

    frameworks: ['mocha', 'chai', 'sinon', 'sinon-chai'],
    plugins: [
        'karma-chrome-launcher',
        'karma-mocha',
        'karma-chai',
        'karma-sinon',
        'karma-sinon-chai',
        'karma-sourcemap-loader',
        'karma-webpack'
    ],
    files: [
      'tests.webpack.js'
    ],
    exclude: [],
    preprocessors: {
        'tests.webpack.js': ['webpack', 'sourcemap']
    },

    webpack: webpackConfig,
    webpackMiddleware: {
        noInfo: true
    },

    reporters: ['progress'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_DEBUG,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: true,
  });
}

./tests.webpack.js

'use strict';

require('babel-polyfill');
require('core-js/fn/object/assign');

var context = require.context('./test', true, /Test\.jsx$/);
context.keys().forEach(context);

示例测试文件 (test/app/AppTest.jsx):

'use strict';

var TestUtils = require('react-addons-test-utils');
import {expect} from 'chai';

describe('App', () => {

    it('should display correct text on render', () => {
        let component = TestUtils.renderIntoDocument(<App/>);
        expect('hello').to.equal('hello');
    });

});

这里是 karma 调试输出(我删除了时间,所以它更具可读性):

DEBUG: [config]: autoWatch set to false, because of singleRun
DEBUG [plugin]: Loading plugin karma-chrome-launcher.
DEBUG [plugin]: Loading plugin karma-mocha.
DEBUG [plugin]: Loading plugin karma-chai.
DEBUG [plugin]: Loading plugin karma-sinon.
DEBUG [plugin]: Loading plugin karma-sinon-chai.
DEBUG [plugin]: Loading plugin karma-sourcemap-loader.
DEBUG [plugin]: Loading plugin karma-webpack.
DEBUG [web-server]: Instantiating middleware
DEBUG [preprocessor.sourcemap]: base64-encoded source map for /Users/gasim/Stack/gasim/gasim-frontend/tests.webpack.js
INFO [karma]: Karma v1.1.0 server started at http://localhost:9876/
INFO [launcher]: Launching browser Chrome with unlimited concurrency
INFO [launcher]: Starting browser Chrome
DEBUG [temp-dir]: Creating temp dir at /var/folders/0q/z4cbhb7x49jgk2ycw4f9hxd00000gn/T/karma-37005516
DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/0q/z4cbhb7x49jgk2ycw4f9hxd00000gn/T/karma-37005516 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling http://localhost:9876/?id=37005516
DEBUG [web-server]: serving: /Users/gasim/Stack/gasim/gasim-frontend/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /Users/gasim/Stack/gasim/gasim-frontend/node_modules/karma/static/karma.js
DEBUG [karma]: A browser has connected on socket /#ZLT5diBbmtOJweMIAAAA
DEBUG [web-server]: upgrade /socket.io/?EIO=3&transport=websocket&sid=ZLT5diBbmtOJweMIAAAA
DEBUG [web-server]: serving: /Users/gasim/Stack/gasim/gasim-frontend/node_modules/karma/static/favicon.ico
INFO [Chrome 51.0.2704 (Mac OS X 10.11.5)]: Connected on socket /#ZLT5diBbmtOJweMIAAAA with id 37005516
DEBUG [launcher]: Chrome (id 37005516) captured in 2.52 secs
DEBUG [middleware:karma]: custom files null null
DEBUG [middleware:karma]: Serving static request /context.html
DEBUG [web-server]: serving: /Users/gasim/Stack/gasim/gasim-frontend/node_modules/karma/static/context.html
DEBUG [web-server]: serving: /Users/gasim/Stack/gasim/gasim-frontend/node_modules/karma/static/context.js
Chrome 51.0.2704 (Mac OS X 10.11.5) ERROR
  You need to include some adapter that implements __karma__.start method!

我真正感兴趣的是调试输出中的以下行:

DEBUG [middleware:karma]: custom files null null

为什么说null null?这是否意味着测试文件为空或其他内容?

这里这一行的问题:

frameworks: ['mocha', 'chai', 'sinon', 'sinon-chai'],

无需包含 chaisinon。他们是给我错误的人。所以,我只保留了 mochasinon-chai,我只是从我的测试脚本中加载 chaisinon