5

こんにちは、angular のこのチュートリアルに従っていますが、次のコマンド test.bat を実行します。私はこのエラーを受け取り、あまりよくないことが原因である可能性があります。

「スクリプトをロードできません。登録されていません!プラグインが不足している可能性があります」

このチュートリアルのすべての手順に従いましたが、プラグインが足りないと思います。アプリケーションのルートに node_modules というフォルダがあり、これらのプラグインはすべてここにあります

     karma
     karma-chrome-launcher
     karma-coffee-preprocessor
     karma-firefox-launcher
     karma-html2js-preprocessor
     karma-jasmine
     karma-junit-reporter
     karma-phantomjs-launcher
     karma-RequireJS
     karma-script-launcher

私のkarma.config

module.exports = function(config){

config.set({
basePath : '../',

files : [
  'app/lib/angular/angular.js',
  'app/lib/angular/angular-*.js',
  'test/lib/angular/angular-mocks.js',
  'app/js/**/*.js',
  'test/unit/**/*.js'
],

exclude: ['app/lib/angular/angular-scenario.js'],

autoWatch : true,

frameworks: ['jasmine'],

browsers : ['C:/Program Files/Google/Chrome/Application/chrome.exe'],

plugins : [
  'karma-junit-reporter',
  'karma-chrome-launcher',
  'karma-firefox-launcher',
  'karma-jasmine'
],

junitReporter : {
  outputFile: 'test_out/unit.xml',
  suite: 'unit'
}

})}

誰でも私を助けることができますか?

ありがとう

4

1 に答える 1

6

不足しているプラ​​グインを Karma config plugins セクションに追加する必要があります。

plugins : [
  'karma-junit-reporter',
  'karma-chrome-launcher',
  'karma-firefox-launcher',
  'karma-jasmine'
],

または、単にこのプラグイン セクションを削除すると、カルマは見つかったすべてのプラグインをロードします。(プラグインがあまりない場合は、これで問題ありません)

編集:

テストプロジェクトを複製してインストールしました。インストールされている依存関係は次のとおりです。

karma                      
karma-html2js-preprocessor  
karma-phantomjs-launcher
karma-chrome-launcher      
karma-jasmine               
karma-requirejs
karma-coffee-preprocessor  
karma-junit-reporter        
karma-script-launcher
karma-firefox-launcher     
karma-ng-scenario           
phantomjs

phantomjs がインストールされていないようです。

于 2013-11-01T12:46:45.657 に答える