1

伙计们。我正在尝试使用 Karma 进行单元测试。但它在控制台中的执行只是冻结在线“浏览器已连接到套接字”。我在Win 8中工作。

我使用命令karma start karma.conf.js

这是我的 karma.conf.js

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

   basePath: '',

   frameworks: ['jasmine'],


   files: [
     '../test/unit/trytest.js'
   ],


   exclude: [

   ],

   reporters: ['progress'],

   port: 9876,

   colors: true,

   logLevel: config.LOG_DEBUG,


   autoWatch: true,

   browsers: ['Chrome'],

   captureTimeout: 60000,

   singleRun: false
 });
};

这是我的 trytest.js

describe('panda',function(){
  it('is happy',function(){
    expect('sad').toBe('sad');
  });
});

这是控制台中的输出

Z:\home\localhost\www\phonecat\scripts>karma start karma.conf.js
DEBUG [plugin]: Loading karma-* from C:\Users\Timur.timur-work-pc\AppData\Roamin
g\npm\node_modules
DEBUG [plugin]: Loading plugin C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\
node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\
node_modules/karma-coffee-preprocessor.
DEBUG [plugin]: Loading plugin C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\
node_modules/karma-firefox-launcher.
DEBUG [plugin]: Loading plugin C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\
node_modules/karma-html2js-preprocessor.
DEBUG [plugin]: Loading plugin C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\
node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\
node_modules/karma-junit-reporter.
DEBUG [plugin]: Loading plugin C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\
node_modules/karma-phantomjs-launcher.
DEBUG [plugin]: Loading plugin C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\
node_modules/karma-requirejs.
DEBUG [plugin]: Loading plugin C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\
node_modules/karma-script-launcher.
DEBUG [plugin]: Loading inlined plugin (defining ).
INFO [karma]: Karma v0.10.4 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [launcher]: Creating temp dir at C:\Users\TIMUR~1.TIM\AppData\Local\Temp\k
arma-89863124
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --
user-data-dir=C:\Users\TIMUR~1.TIM\AppData\Local\Temp\karma-89863124 --no-defaul
t-browser-check --no-first-run --disable-default-apps --start-maximized http://l
ocalhost:9876/?id=89863124
DEBUG [watcher]: Resolved files:
    C:/Users/Timur.timur-work-pc/AppData/Roaming/npm/node_modules/karma-jasm
    ine/lib/jasmine.js
    C:/Users/Timur.timur-work-pc/AppData/Roaming/npm/node_modules/karma-jasm
    ine/lib/adapter.js
    Z:/home/localhost/www/phonecat/test/unit/trytest.js
DEBUG [watcher]: Watching "Z:/home/localhost/www/phonecat/test/unit/trytest.js"
DEBUG [web-server]: serving: C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\no
de_modules\karma\static/client.html
DEBUG [web-server]: serving: C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\no
de_modules\karma\static/karma.js
DEBUG [karma]: A browser has connected on socket __xPIFu3Fwmkkx1H4VKI

我使用版本 0.10.4 的 Karma 和版本 0.10.20 的 node.js 我不喜欢在“服务:C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\node_modules \karma\static/client.html”和“C:\Users\Timur.timur-work-pc\AppData\Roaming\npm\node_modules\karma\static/karma.js”。但是不知道哪里可以改。

4

0 回答 0