Karma Jasmine NPM 配置

Karma Jasmine NPM config

karma 配置错误

我正在尝试配置我的测试环境,当我尝试 运行 业力时出现以下错误。

karma start
06 10 2015 13:13:36.859:DEBUG [plugin]: Loading plugin karma-jasmine.
06 10 2015 13:13:36.917:DEBUG [karma]: List of files has changed, trying to execute
06 10 2015 13:13:36.918:WARN [karma]: No captured browser, open http://localhost:9876/
06 10 2015 13:13:36.922:DEBUG [watcher]: Watching ".../representative-summary/node_modules/angular"
06 10 2015 13:13:36.922:DEBUG [watcher]: Watching ".../representative-summary/node_modules/angular-resource"
06 10 2015 13:13:36.923:DEBUG [watcher]: Watching ".../representative-summary/spec"
06 10 2015 13:13:36.927:WARN [launcher]: Can not load "karma-chrome-launcher", it is not registered!
  Perhaps you are missing some plugin?
06 10 2015 13:13:36.927:WARN [launcher]: Can not load "karma-firefox-launcher", it is not registered!
  Perhaps you are missing some plugin?
06 10 2015 13:13:36.928:WARN [launcher]: Can not load "karma-safari-launcher", it is not registered!
  Perhaps you are missing some plugin?
06 10 2015 13:13:36.928:WARN [launcher]: Can not load "karma-ie-launcher", it is not registered!
  Perhaps you are missing some plugin?
06 10 2015 13:13:36.928:WARN [launcher]: Can not load "karma-phantomjs-launcher", it is not registered!
  Perhaps you are missing some plugin?

karma.conf.js

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

        basePath: '',
        frameworks: ['jasmine'],
        files: [
            {pattern: 'node_modules/angular/*.js', included: true},
            {pattern: 'node_modules/angular-resource/*.js', included: true},
            {pattern: 'spec/*.spec.js', included: true}
        ],
        reporters: ['progress'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_DEBUG,
            //config.LOG_INFO,
        autoWatch: true,
        browsers: [
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-safari-launcher',
            'karma-phantomjs-launcher'
        ],
        plugins: ['karma-jasmine'],
        singleRun: false
    })
};

我在 OSX Yosemite 10.10.5,是的,那里有一个独立测试 "expect true to be true" 只是为了启动它 运行本身。我正在编写的应用程序是 Angular,但我还没有触及任何测试。我只想让基本测试 运行ner 先正常工作。

任何帮助都会很棒。谢谢

karma 中的浏览器采用英文格式(ChromeFirefoxPhantomJS),而不是它们各自的插件名称。插件只需要安装 npm install --save.

另外:Karma 将 "magically" 加载你的 node_modules 目录中以 karma- 开头的任何库,所以你根本不需要在你的文件中声明 plugins:配置文件。