大佬教程收集整理的这篇文章主要介绍了angularjs – Karma / Jasmine / PhantomJs:undefined不是构造函数,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_696_7@TypeError: undefined is not a constructor (evaluaTing 'allKeys[i].match(/^[0-9]+$/)') in node_modules/jasmine-core/lib/jasmine-core/jasmine.js (line 2988) test/spec/core/http/response-spec.js:92:63 loaded@http://localhost:8080/context.js:151:17
大多数测试都通过了,但是很少有一些测试.这是打破的测试之一:
@H_696_7@(function () { 'use Strict'; describe('MyAccount.core.http.response',function () { var ResponseInterceptor = {},$httpProvider = {},$window = {},env = {},messageQueue = {}; beforeEach(module('MyAccount.core.environment')); beforeEach(module('MyAccount.core.http',function (_$httpProvider_,$providE) { $httpProvider = _$httpProvider_; messageQueue = { dispatch: jasmine.createSpy('dispatch') }; $window = { LOCATIOn: { href: jasmine.createSpy() } }; $provide.value('$window',$window); $provide.value('messageQueue',messageQueuE); })); beforeEach(inject(function (_$window_,_ResponseInterceptor_,_env_) { $window = _$window_; ResponseInterceptor = _ResponseInterceptor_; env = _env_; })); describe('response status',function () { // AsserTing that 404 and 403 errors arE intercepted. angular.forEach([404,403],function (error) { describe('is ' + error,function () { beforeEach(function () { ResponseInterceptor.responseError({ status: error,data: { message: 'error ' + error } }); }); it('calls messageQueue.dispatch with the error message',function () { expect(messageQueue.dispatch).toHaveBeenCalledWith('error ' + error,{ on: 'global.errors' }); }); }); }); }); }); })();
我已经坚持了几个小时,似乎无法找到解决方案.以下是我正在使用的依赖项及其版本:
>因果报应:^ 1.2.0
> jasmine-core:^ 2.5.0
> karma-jasmine:^ 1.0.2
> karma-phantomjs-launcher:^ 1.0.2
> phantomjs:^ 2.1.7
注意:这是一个使用角度发生器的全新自耕农应用程序.
以上是大佬教程为你收集整理的angularjs – Karma / Jasmine / PhantomJs:undefined不是构造函数全部内容,希望文章能够帮你解决angularjs – Karma / Jasmine / PhantomJs:undefined不是构造函数所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。