I get this error running scripts/test.bat via console
Chrome 48.0.2564 (Windows 7 0.0.0) ERROR
Uncaught TypeError: Cannot read property 'module' of undefined
I am under Windows 7 as you can notice and using Angular Seed.
It seems like you've missed loading angular-mock library before listing test files in karma configuration under files:[] section. You need angular-mock library loaded before listing any test files. Beware that angular-mocks library in turn expects angular.js to be loaded before it.
refer: https://docs.angularjs.org/api/ngMock
Related
I have installed the following library
https://github.com/gdi2290/angular-websocket
in my AngularJS 1.5 application. When i go to run I get the following
Uncaught TypeError: Cannot read property 'noop' of undefined
at angular-websocket.js:46
at angular-websocket.js:10
at angular-websocket.js:13
Line 46: var noop = _angular2.default.noop;
Any ideas
My code works on development mode, uncompressed. But when I use grunt's minify functionality and run the app in production mode, I get that error: Uncaught TypeError: angular.module(...).run(...) is not a function.
When I look into the error in Google Chrome Developer Tools, I get what you see in the screenshot. Does anybody understand where the problem is?
I am using Angular 1.4+ in Angular-Fullstack. The error occurs in vendor.{{randomstring}}.js.
Thanks for any support!
You have 2 issues here.
Dependency injection. You can edit manually the archives or use https://github.com/mgol/grunt-ng-annotate this will do this automagically for you.
Concatenation. Check this grunt plugin https://github.com/gruntjs/grunt-contrib-concat the issue here is javascript dont understand when a function end/start because dont have a separation mark, check where the error is.
})(function(a,b) {
It should be:
});(function(a,b) {
Check the "Concatenating with a custom separator" example of grunt-contrib-concat
I am kinds of stuck. Here is what we are doing.
We have written angular code in 2.0 style where our app.js ahs the magic to convert components in directive and controller which is little complex.
Now I have to write test cases using karma & jasmine and we have create a framework for that but it doesn't work if I call our angular code. If I remove app.js from the angular code then I can reach to the class function, but as I add our app.js it give me errors like
Chrome 46.0.2490 (Windows 7 0.0.0) ERROR
Uncaught Error: Bootstrap's JavaScript requires jQuery
even though the kquery is already loaded.
or
22 10 2015 14:31:34.895:DEBUG [web-server]: serving (cached): /app/vendor/angular/angular-aria.js
Chrome 46.0.2490 (Windows 7 0.0.0) ERROR
Uncaught TypeError: Cannot read property 'module' of undefined
But if I write a small class/component everything works fine.
Has anyone did this(coding in 2.0 style) and written test cases for that.
If yes can you please help me what I should be doing or not doing.
Thank you
Manish
Here is the complete error text:
Page error: TypeError: 'undefined' is not a function (evaluating 'ModuleStore.register.bind(ModuleStore)')
Page error: ReferenceError: Can't find variable: angular
I am using phantomJS 2.0 with casperjs 1.1-beta3
UPDATE: I had multiple phantomjs versions installed. When using phantomjs -v command, it was showing me 2.0.0 but when I used casperjs command, it showed me that casperjs is using different version.
I'm setting up a standard (but simpler) test environment for an Angular app. What I'm using is Mocha, Chai, Angular, Angular-Mocks (since that's needed unless you use Jasmine afaik).
Angular and angular-mocks are version 1.3.10, but this happens for 1.3.15 as well, these are the two versions I tested with.
The problem is that I receive this error from the js console when loading the angular-mocks script.
Uncaught TypeError: undefined is not a function
The lines it's complaining about in angular-mocks is:
(window.beforeEach || window.setup)(function() {
currentSpec = this;
});
So angular-mocks is trying to grab a global function which doesn't exist in this case, right? Why, and how do I prevent it? Is there a actual problem?
Here's a js fiddle with the code and the problem
I then get the following error when trying to use inject()
Uncaught ReferenceError: inject is not defined
Why is this happening?