Karma Angular基准测试

时间:2015-08-08 20:44:20

标签: angularjs coffeescript benchmarking microbenchmark

我正在尝试将简单的mocha / jasmine CoffeeScript测试转换为可行的基准测试:

beforeEach module('ngVendorMimeType')

beforeEach inject ($injector) ->
  $httpBackend = $injector.get('$httpBackend')
  $http = $injector.get('$http')

afterEach ->
  $httpBackend.verifyNoOutstandingExpectation()
  $httpBackend.verifyNoOutstandingRequest()

describe 'should not match the request url', ->
  it 'should not alter the Accept', ->
    path = '/views/index.html'
    $httpBackend.expectGET(path, (headers) ->
      return headers.Accept == 'text/html'
    ).respond(200)
    $http.get(path, (
      headers: (
        'Accept': 'text/html'
      )
    ))
    $httpBackend.flush()

由于窗口对象不可参考,我尝试了karma-benchmark而没有成功。是否有工具/框架可以帮助实现这一目标。我唯一的期望是它通过Karma运行Angular测试集成,可选择在PhantomJS上运行并提供一些输出报告。

0 个答案:

没有答案