title: Jasmine: why beforeEach() works in nested describe but beforeAll() doesn't?
body: <p>I am struggling to understand why my code won't work and why the tests fail when I use a simple <code>beforeAll()</code> instead of a <code>beforeEach()</code> in a nested describe suite of tests? Here is a small example to outline my problem:</p>
  
  <pre><code>describe("myService", function() {
    // Basic services
    // Some variables 
  
    beforeEach(module('app'));   // Invoke the module
    beforeEach(function(){
  
      // Inject the services
      inject(function(_myService_) {
        myService = _myService_;
      });
    });
  
    /************************ Add more unit tests here ************************/
  
    describe("myFunction", function() {
      describe("calls function with one set of input paramenters", function() {
  
        //beforeAll(function() {
        beforeEach(function() { // &lt;-- Why this works but beforeAll doesn't???
          // Call myFunction with different parameters
          result = myService.myFunction(parametersType_1);
        });
  
        it("should do tests on result (the return from the function)", function() {
        });
      });
  
    describe("calls function with other set of input paramenters", function() {
  
      //beforeAll(function() {
      beforeEach(function() { // &lt;-- Why this works but beforeAll doesn't???
        // Call myFunction with different parameters
        result = myService.myFunction(parametersType_2);
      });
  
      it("should do tests on result (the return from the function)", function() {
      });
    });
  }); 
  </code></pre>