我正在尝试将简单的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上运行并提供一些输出报告。