ngmockhttp's People
ngmockhttp's Issues
I'm trying to figure out what a TypeScript version of this would look like
I'm working in a TypeScript world, so I'm trying to figure out what this looks like in TypeScript. It doesn't appear that the angular-mocks.d.ts definition exports the angular.mock.$<whatever>
variables, so I'm either trying to write around that or figure out how to bottle this up as a JavaScript file and write a suitable .d.ts
file to go with it.
Error when running with latest dependencies versions
I got this error stack:
PhantomJS 1.9.8 (Windows 8 0.0.0) movies app tests with real http requests (workaround) should load default movies with real http request FAILED
Error: [$injector:modulerr] Failed to instantiate module ngMock due to:
Error: [$injector:unpr] Unknown provider: $$asyncCallbackProvider
http://errors.angularjs.org/1.5.0-rc.0/$injector/unpr?p0=%24%24asyncCallbackProvider
at C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4463
at getService (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4616)
at decorator (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4538)
at C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/test/ngMockHttp.js:13
at invoke (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4657)
at runInvokeQueue (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4563)
at C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4572
at forEach (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:340)
at loadModules (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4595)
at createInjector (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4475)
at workFn (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular-mocks/angular-mocks.js:2677)
http://errors.angularjs.org/1.5.0-rc.0/$injector/modulerr?p0=ngMock&p1=Error%3A%20%5B%24injector%3Aunpr%5D%20Unknown%20provider%3A%20%24%24asyncCallbackProvider%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.5.0-rc.0%2F%24injector%2Funpr%3Fp0%3D%2524%2524asyncCallbackProvider%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2FC:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed%2Fapp%2Fassets%2Flibs%2Fangular%2Fangular.js%3Fd9be8901ca4dab15b3f2227f5b17f7749c4453f2%3A4463%0A%20%20%20%20at%20getService%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fassets%2Flibs%2Fangular%2Fangular.js%3Fd9be8901ca4dab15b3f2227f5b17f7749c4453f2%3A4616)%0A%20%20%20%20at%20decorator%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fassets%2Flibs%2Fangular%2Fangular.js%3Fd9be8901ca4dab15b3f2227f5b17f7749c4453f2%3A4538)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Ftest%2FngMockHttp.js%3F6b96fb90c02d1e98d02ed527fffbc7981674fdce%3A13%0A%20%20%20%20at%20invoke%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fassets%2Flibs%2Fangular%2Fangular.js%3Fd9be8901ca4dab15b3f2227f5b17f7749c4453f2%3A4657)%0A%20%20%20%20at%20runInvokeQueue%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fassets%2Flibs%2Fangular%2Fangular.js%3Fd9be8901ca4dab15b3f2227f5b17f7749c4453f2%3A4563)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fassets%2Flibs%2Fangular%2Fangular.js%3Fd9be8901ca4dab15b3f2227f5b17f7749c4453f2%3A4572%0A%20%20%20%20at%20forEach%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fassets%2Flibs%2Fangular%2Fangular.js%3Fd9be8901ca4dab15b3f2227f5b17f7749c4453f2%3A340)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fassets%2Flibs%2Fangular%2Fangular.js%3Fd9be8901ca4dab15b3f2227f5b17f7749c4453f2%3A4595)%0A%20%20%20%20at%20createInjector%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fassets%2Flibs%2Fangular%2Fangular.js%3Fd9be8901ca4dab15b3f2227f5b17f7749c4453f2%3A4475)%0A%20%20%20%20at%20workFn%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fapp%2Fassets%2Flibs%2Fangular-mocks%2Fangular-mocks.js%3F3d9c94fe77b741830fa9c479725e33bc9eaa4bd7%3A2677)%0A%20%20%20%20at%20attemptSync%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A1886)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A1874%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A1859%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A697%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A363%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A2479%0A%20%20%20%20at%20attemptAsync%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A1916)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A1871%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A1859%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A697%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A2473%0A%20%20%20%20at%20attemptAsync%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A1916)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A1871%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A1859%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A697%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A2332%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3F391e45351df9ee35392d2e5cb623221a969fc009%3A761%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fadapter.js%3F3030709c83121e1b2ca4d1e657306b834fc13350%3A318%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fkarma.js%3A193%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fcontext.html%3A56
at forEach (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:340)
at loadModules (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4595)
at createInjector (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4475)
at workFn (C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular-mocks/angular-mocks.js:2677)
at C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/assets/libs/angular/angular.js:4593
TypeError: 'undefined' is not a function (evaluating '$controller('MoviesController', {})')
at C:/Users/eduardo.delai/Documents/Eduardo Delai/angularjs/ng-seed/app/js/movies/movies.controller.spec.js:222
PhantomJS 1.9.8 (Windows 8 0.0.0): Executed 1 of 1 (1 FAILED) ERROR (0.012 secs / 0.025 secs)
When running this code:
describe('movies app tests with real http requests (workaround)', function() {
beforeEach(angular.mock.http.init);
afterEach(angular.mock.http.reset);
beforeEach(angular.mock.module('moviesModule'));
var $controller;
beforeEach(angular.mock.inject(function(_$controller_, _$httpBackend_) {
$controller = _$controller_;
$httpBackend = _$httpBackend_;
/*making a real http request with ngMockE2E*/
$httpBackend.whenGET('http://www.omdbapi.com/?s=terminator').passThrough();
}));
it('should load default movies with real http request', function(done) {
var moviesController = $controller('MoviesController', {});
moviesController.keyword = 'terminator';
moviesController.getMovieData();
setTimeout(function() {
expect(moviesController.movies).not.toEqual([]);
done();
}, 1000);
});
});
Under these dependencies:
"jasmine-core": "^2.4.1",
"karma": "^0.13.19",
"karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "^0.2.3",
"phantomjs": "^1.9.19"
Any chance your code isn't compatible with the latest version of angular-mocks?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.