Grunt Karma永远挂起

时间:2015-05-21 17:46:28

标签: javascript node.js gruntjs phantomjs karma-runner

我有2个配置,我想测试,包装和应用程序。由于技术原因,这些需要是分开的配置。当我跑步时," grunt karma:app"或者" grunt karma:wrapper"我得到以下内容:

Running "karma:wrapper" (karma) task
INFO [karma]: Karma v0.12.32 server started at http://localhost:9876/

无限期挂起。贝娄是我的笨拙配置:

       karma: {
            app: {
                unit: {
                    configFile: 'test/karma.app.conf.js',
                    singleRun: true
                }
            },
            wrapper: {
                unit: {
                    configFile: 'test/karma.wrapper.conf.js',
                    singleRun: true
                }
            }
        }

Bellow是我的业力配置文件:

应用

// Karma configuration
// http://karma-runner.github.io/0.12/config/configuration-file.html
// Generated on 2015-04-14 using
// generator-karma 0.9.0

module.exports = function(config) {
  'use strict';

  config.set({
    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // base path, that will be used to resolve files and exclude
    basePath: '../dist',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine-jquery', 'jasmine'],

    // list of files / patterns to load in the browser
    files: [
      // scripts
      'app.min.js',

      // test files
      '../test/spec/*.app.spec.js'
    ],

    // list of files / patterns to exclude
    exclude: [
    ],

    // web server port
    port: 8080,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: [
      'Chrome_without_security'
    ],

    customLaunchers: {
      Chrome_without_security: {
        base: 'Chrome',
        flags: ['--disable-web-security', '--debug']
      }
    },

    // Which plugins to enable
    plugins: [
      'karma-jasmine-jquery',
      'karma-phantomjs-launcher',
      'karma-chrome-launcher',
      'karma-jasmine'
    ],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false,

    colors: true,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // Uncomment the following lines if you are using grunt's server to run the tests
    proxies: {
       '/': 'http://localhost:9000/'
    }
    // URL root prevent conflicts with the site root
    // urlRoot: '_karma_'
  });
};

包装

// Karma configuration
// http://karma-runner.github.io/0.12/config/configuration-file.html
// Generated on 2015-04-14 using
// generator-karma 0.9.0

module.exports = function(config) {
  'use strict';

  config.set({
    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // base path, that will be used to resolve files and exclude
    basePath: '../dist',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine-jquery', 'jasmine'],

    // list of files / patterns to load in the browser
    files: [
      // scripts
      'iWrapper.min.js',

      // test files
      '../test/spec/*.wrapper.spec.js'
    ],

    // list of files / patterns to exclude
    exclude: [
    ],

    // web server port
    port: 8080,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: [
      'PhantomJS'
    ],

    customLaunchers: {
      Chrome_without_security: {
        base: 'Chrome',
        flags: ['--disable-web-security', '--debug']
      }
    },

    // Which plugins to enable
    plugins: [
      'karma-jasmine-jquery',
      'karma-phantomjs-launcher',
      'karma-chrome-launcher',
      'karma-jasmine'
    ],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false,

    colors: true,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO

    // Uncomment the following lines if you are using grunt's server to run the tests
//    proxies: {
//       '/': 'http://localhost:9000/'
//    }
    // URL root prevent conflicts with the site root
    // urlRoot: '_karma_'
  });
};

0 个答案:

没有答案