我試圖使用業力運行單元測試,並且出現錯誤You need to include some adapter that implements __karma__.start method!
。我試着用grunt
和karma start
命令運行。我做了谷歌搜索,所有的解決方案都沒有解決。不知道我做錯了什麼。我在karma.conf.js文件的插件下包含了帶有karma-jasmine的正確適配器,它有__karma__.start
方法。這是我的配置文件: -錯誤:您需要包含一些實現__karma __的適配器。啓動方法
module.exports = function(config){
config.set({
// root path location that will be used to resolve all relative paths in files and exclude sections
basePath : '../',
files : [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'node_modules/requirejs/require.js',
'node_modules/karma-jasmine/lib/adapter.js',
'app.js',
'mainapp/mainapp.js',
'mainapp/notes/notes.js',
'mainapp/notes/partial/create/create.js',
'mainapp/notes/partial/create/create-spec.js'
],
// files to exclude
exclude: [
'bower_components/angular/angular/*.min.js'
],
// karma has its own autoWatch feature but Grunt watch can also do this
autoWatch : false,
// testing framework, be sure to install the correct karma plugin
frameworks: ['jasmine', 'browserify', 'requirejs'],
// browsers to test against, be sure to install the correct browser launcher plugins
browsers : ['PhantomJS'],
// map of preprocessors that is used mostly for plugins
preprocessors: {
'mainapp/notes/partial/create/create-spec.js' : ['browserify']
},
reporters: ['progress'],
// list of karma plugins
plugins : [
'karma-teamcity-reporter',
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-babel-preprocessor',
'karma-requirejs',
'karma-jasmine',
'karma-browserify'
],
singleRun: true
})}
爲什麼有人應該處理這個文件...? – Jim
是的,我忘了提及如何包含它。我編輯了答案補充說。 – Louis