currentSpec in Jasmine 2 is undefined
问题 I want to upgrade my test suite to the latest Jasmine version 2.3.4. I have some custom helper methods for testing AngularJS stuff inside my spy_helper.js like this: (function() { this.stubPromise = function(service, functionName) { var $q = jasmine.getEnv().currentSpec.$injector.get("$q") var $rootScope = jasmine.getEnv().currentSpec.$injector.get("$rootScope") var deferred = $q.defer(); var spy = spyOn(service, functionName).andReturn(deferred.promise); spy.andResolveWith = function(value)