Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

"Uncaught ReferenceError: minErr is not defined" running scripts/test.bat #110

Closed
joewhite opened this issue Oct 16, 2013 · 13 comments
Closed

Comments

@joewhite
Copy link
Contributor

If I clone the latest angular-seed (3fb3966), run npm install, and then run scripts\test.bat, I get the following output:

INFO [karma]: Karma v0.10.2 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 30.0.1599 (Windows 8)]: Connected on socket -TJSfJA1z5LbpRgfLTn-
Chrome 30.0.1599 (Windows 8) ERROR
        Uncaught ReferenceError: minErr is not defined
        at C:/dev/temp/angular-seed/app/lib/angular/angular-loader.js:19
Chrome 30.0.1599 (Windows 8) ERROR
        Uncaught ReferenceError: minErr is not defined
        at C:/dev/temp/angular-seed/app/lib/angular/angular-loader.min.js:6
Chrome 30.0.1599 (Windows 8): Executed 0 of 0 ERROR (0.272 secs / 0 secs)

So it gives this "minErr is not defined" error, and doesn't run any tests.

I'm using the latest Karma (0.10.2) on Windows 8.

If I clone and then immediately reset to the previous revision (3fb3966) and then npm install, then I can run the tests without errors. So it looks like this bug was introduced when angular-seed was updated to use Angular 1.2.0-rc3. I'm not sure whether it's an Angular bug or a problem with the way angular-seed is configured.

@bettlebrox
Copy link

Same problem on ubuntu 12.10

@zsumore
Copy link

zsumore commented Oct 17, 2013

I copy this code to angular-loader.js, it work...
function minErr(module) {
return function () {
var code = arguments[0],
prefix = '[' + (module ? module + ':' : '') + code + '] ',
template = arguments[1],
templateArgs = arguments,
stringify = function (obj) {
if (isFunction(obj)) {
return obj.toString().replace(/ {[\s\S]*$/, '');
} else if (isUndefined(obj)) {
return 'undefined';
} else if (!isString(obj)) {
return JSON.stringify(obj);
}
return obj;
},
message, i;

message = prefix + template.replace(/\{\d+\}/g, function (match) {
  var index = +match.slice(1, -1), arg;

  if (index + 2 < templateArgs.length) {
    arg = templateArgs[index + 2];
    if (isFunction(arg)) {
      return arg.toString().replace(/ ?\{[\s\S]*$/, '');
    } else if (isUndefined(arg)) {
      return 'undefined';
    } else if (!isString(arg)) {
      return toJson(arg);
    }
    return arg;
  }
  return match;
});

message = message + '\nhttp://errors.angularjs.org/' + version.full + '/' +
  (module ? module + '/' : '') + code;
for (i = 2; i < arguments.length; i++) {
  message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
    encodeURIComponent(stringify(arguments[i]));
}

return new Error(message);

};
}

@lsinger
Copy link

lsinger commented Oct 18, 2013

Same on OS X. I suppose it's a kink in rc3 that will get ironed out when angular/angular.js#4437 is addressed. Until then, @zsumore's workaround works for me.

@borismee
Copy link

Thanks, zsumore!!! Works for me on Win7

@brettfattori
Copy link

Any idea of when a resolution to this will appear? We don't want to modify angular-loader.js.

@jambutler
Copy link

Thanks zsumore. It's working for me too. For others doing this fix, don't forget to paste the code into angular-loader.min.js too - just before the line
var l=minErr("$injector");

Jim

@rustyfausak
Copy link

Added

exclude: ['app/lib/angular/angular-loader*.js'],

to config/karma.conf.js and it worked.

@MrBillA
Copy link

MrBillA commented Oct 25, 2013

The minErr function is defined in angular.js though for some reason angular-loader is not picking it up. While the workaround outlined above works, it would be educational to find out why it breaks in karma. The karma configuration includes angular.js first so one would think angular-loader would pick it up.

@granteagon
Copy link

Had the same issue:

air:Project ./scripts/test.sh

Starting Karma Server (http://karma-runner.github.io)
-------------------------------------------------------------------
INFO [karma]: Karma v0.10.4 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 30.0.1599 (Mac OS X 10.7.5)]: Connected on socket Mx-S7zaV8jikrdIEdvcE
Chrome 30.0.1599 (Mac OS X 10.7.5) ERROR
    Uncaught ReferenceError: minErr is not defined
    at /Project/app/lib/angular/angular-loader.js:19
Chrome 30.0.1599 (Mac OS X 10.7.5): Executed 0 of 0 ERROR (0 secs / Chrome 30.0.1599 (Mac OS X 10.7.5) ERROR
    Uncaught ReferenceError: minErr is not defined
    at /Project/app/lib/angular/angular-loader.min.js:6
Chrome 30.0.1599 (Mac OS X 10.7.5): Executed 0 of 0 ERROR (0 secs / Chrome 30.0.1599 (Mac OS X 10.7.5): Executed 0 of 0 ERROR (0.233 secs / 0 secs)
INFO [watcher]: Changed file "/Project/app/lib/angular/angular-loader.js".
Chrome 30.0.1599 (Mac OS X 10.7.5) ERROR
    Uncaught ReferenceError: minErr is not defined
    at /Project/app/lib/angular/angular-loader.min.js:6
Chrome 30.0.1599 (Mac OS X 10.7.5): Executed 0 of 0 ERROR (0 secs / Chrome 30.0.1599 (Mac OS X 10.7.5): Executed 0 of 0 ERROR (0.402 secs / 0 secs)

To fix I updated angular.loader.js, line 6 from:

var $injectorMinErr = minErr('$injector');

to:

var $injectorMinErr = angular.$$minErr('$injector');

and updated angular.loader.min.js line 6 to:

(function(k){'use strict';function d(c,b,e){return c[b]||(c[b]=e())}var l=angular.$$minErr("$injector");return d(d(k,"angular",Object),"module",function(){var c={};return function(b,e,f){assertNotHasOwnProperty(b,"module");e&&c.hasOwnProperty(b)&&(c[b]=null);return d(c,b,function(){function a(a,b,d){return function(){c[d||"push"]([a,b,arguments]);return g}}if(!e)throw l("nomod",b);var c=[],d=[],h=a("$injector","invoke"),g={_invokeQueue:c,_runBlocks:d,requires:e,name:b,provider:a("$provide","provider"),factory:a("$provide",
"factory"),service:a("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),animation:a("$animateProvider","register"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:h,run:function(a){d.push(a);return this}};f&&h(f);return g})}})})(window);

I should have just reminified the file, but I don't know what minifier they are using.

@smessing
Copy link

smessing commented Nov 3, 2013

rustyfausak's fixed worked for me as well.

@marcelbuesing
Copy link

granteagon thanks that fixed the Problem for me.

@StormToft
Copy link

Using rustyfausak's fix. Works great. I recommend you don't modify angular's loader to fix this. ;-)

@petebacondarwin
Copy link
Contributor

This issue is outdated now that we bring in angular via bower. You'll need to run npm update-index-async to update the index-async.html before the index-async.html page will work correctly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests