Jasmine: How to see the reports in the browser?

前提是你 提交于 2020-01-03 09:47:32

问题


THE SITUATION:

I am currently running AngularJs unit tests in the console.

I open the folder in the console and i run karma start and check the result of the tests in the console.

I would like to see the results in the browser but I cannot see them so far. All i can see is this:

THE QUESTION:

How can i see the reports of the tests in the browser? The proper plugin should be karma-jasmine-html-reporter right?

THE CONFIGURATION:

karma.conf.js:

frameworks: ['jasmine'],

files: [
    'bower_components/angular/angular.js',
    'bower_components/angular-mocks/angular-mocks.js',
    './test/**/*.js',
    'app.js'
],

plugins : [
  'karma-chrome-launcher',
  'karma-firefox-launcher',
  'karma-phantomjs-launcher',
  'karma-jasmine',
  'karma-jasmine-html-reporter'

],

browsers: ['PhantomJS', 'Chrome'],

回答1:


Assuming you have jasmine 2.0,

  • add in reporters: ['html'], to your karma.conf.js

  • In the chrome page hit the DEBUG button. You should be taken to a new page that has the report.



来源:https://stackoverflow.com/questions/32243100/jasmine-how-to-see-the-reports-in-the-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!