gpt4 book ai didi

reactjs - Karma 给我一个 __karma__.start 适配器错误,没有任何其他错误

转载 作者:行者123 更新时间:2023-12-02 10:41:42 24 4
gpt4 key购买 nike

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

./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 .

关于reactjs - Karma 给我一个 __karma__.start 适配器错误,没有任何其他错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38225056/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com