Я устанавливаю карму для своего проекта, я сделал следующее, но когда я запустил 'npm run test-karma', я получил следующую ошибку:
"Вам нужно включите некоторый адаптер, который реализует карму .start метод! "
Package. json,
"jasmine": "^3.3.1",
"jasmine-core": "^3.1.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
Karma.conf. js,
const { join } = require('path');
const { constants } = require('karma');
module.exports = () => {
return {
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-spec-reporter'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-mocha-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: ['json-summary', 'html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true,
thresholds: {
emitWarning: false,
global: {
statements: 100,
lines: 100,
branches: 100,
functions: 100
}
}
},
// reporters: ['mocha', 'spec', 'progress', 'kjhtml'],
reporters: ['mocha', 'kjhtml'],
mochaReporter: {
colors: {
success: 'green',
info: 'bgGreen',
warning: 'cyan',
error: 'red'
},
symbols: {
success: '?',
info: 'ℹ️',
warning: '☣️',
error: '❌'
}
},
port: 9876,
colors: true,
autoWatch: true,
browsers: ['Chrome'],
customLaunchers: {
Chrome_without_security: {
base: 'Chrome',
flags: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-gpu',
'--remote-debugging-port=9222'
]
}
},
singleRun: true
};
};
Test.ts,
import 'core-js';
import 'rxjs/Rx';
import 'zone.js/dist/zone';
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/proxy';
import 'zone.js/dist/jasmine-patch';
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
TestBed.initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
const testsContext: any = require.context('./', true, /\.spec/);
testsContext.keys().forEach(testsContext);
Я новичок в этом.