让Karma在Windows上运行

时间:2013-11-09 12:48:55

标签: node.js testing karma-runner

人。我正在尝试使用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

我使用了Karma版本0.10.4和node.js版本0.10.20我不喜欢“服务: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“。但我不知道它可以在哪里改变。

0 个答案:

没有答案