Search code examples
mocha.jsangular-mockplunker

Unable to get Mocha and Angular mocks to work in Plunker


I am trying to show an example of mocha in plunker but it is giving me angular mocks undefined issues. I tried copy and pasting bower angular mocks to no avail.

beforeEach(function(){
  angular.mock.module('plunker');

});

Errored code from angular-mocks says window undefined

(window.beforeEach || window.setup)(function() {
  annotatedFunctions = [];
  currentSpec = this;
});

Plunker found here


Solution

  • You just need to move the angular mocks script below the call to mocha.setup('bdd'); and it works fine.

    I've updated your plunk at http://plnkr.co/edit/yH9V6b?p=preview