2014-03-25 66 views
1

我有一個咕嚕任務,使用Phantom JS來運行Karma單元測試。測試運行但該任務不會退出。這會阻止任何其他任務開始,直到我用ctrl + c手動殺死karma:unit任務。咕嚕噶運行測試,但塊

我karma.conf.js文件是:

// Karma configuration 
// Generated on Thu Mar 06 2014 13:17:21 GMT-0500 (Eastern Standard Time) 

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

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


    // frameworks to use 
    frameworks: ['mocha', 'requirejs', 'chai', 'sinon'], 


    // list of files/patterns to load in the browser 
    files: [ 
     { pattern: 'src/vendor/**/*.js', included: false }, 
     { pattern: 'src/*.js', included: false }, 
     { pattern: 'src/app/*_test.js', included: false }, 
     { pattern: 'src/app/**/*.js', included: false }, 
     { pattern: 'src/app/*_test.js', included: false }, 
     'test-main.js' 
    ], 


    // list of files to exclude 
    exclude: [ 
     'src/app/main.js', 
     '**/Gruntfile.js' 
    ], 


    // test results reporter to use 
    // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 
    reporters: ['progress', 'coverage'], 
    preprocessors: { 
     'src/app/**/!(*_test).js': 'coverage' 
    }, 


    // web server port 
    port: 9876, 


    // enable/disable colors in the output (reporters and logs) 
    colors: true, 


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


    // enable/disable watching file and executing tests whenever any file changes 
    autoWatch: false, 


    // Start these browsers, currently available: 
    // - Chrome 
    // - ChromeCanary 
    // - Firefox 
    // - Opera (has to be installed with `npm install karma-opera-launcher`) 
    // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 
    // - PhantomJS 
    // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 
    browsers: ['PhantomJS'], 


    // If browser does not capture in given timeout [ms], kill it 
    captureTimeout: 10000, 


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

我對因果報應任務步兵配置爲:

karma: { 
      options: { 
       configFile: 'karma.conf.js' 
      }, 
      unit: { 
       autowatch: true, 
       singleRun: true, 
      } 
     }, 

當我運行咕嚕因緣:單位,我得到:

Running "karma:unit" (karma) task 
INFO [karma]: Karma v0.12.0 server started at http://localhost:9876/ 
INFO [launcher]: Starting browser PhantomJS 
INFO [PhantomJS 1.9.7 (Windows 7)]: Connected on socket V2NFfUtyUi_gl0gWqbov with id 17494532 
PhantomJS 1.9.7 (Windows 7): Executed 2 of 2 SUCCESS (0.012 secs/0 secs) 

但它從來沒有達到Done, without errors,直到我按ctrl + C

回答

1

我在項目中重新安裝了業力和PhantomJS,並清除了問題。我注意到,當我改變我的業力配置使用鉻,一切工作正常,所以我覺得這個問題必須與PhantomJS

npm install karma --save-dev 

npm install phantomjs --save-dev