title: Modified JUnit xml reporter for jasmine giving RangeError: Maximum call stack size exceeded
body: <p>I am using a modified version of Jasmine JUnit Reports (found here: <a href="https://github.com/angular/protractor-cookbook/tree/master/jasmine-junit-reports" rel="nofollow noreferrer">https://github.com/angular/protractor-cookbook/tree/master/jasmine-junit-reports</a>) and am getting an error for <code>RangeError: Maximum call stack size exceeded</code></p>
  
  <p>The reason I modified the report is that I needed the xml reports generated at the <code>suiteDone</code> step, not the <code>jasmineDone</code> step. So basically I moved all the code from <code>jasmineDone</code> into <code>suiteDone</code> function, which is now causing the error I am seeing. I am relatively new to js so not exactly sure if some asynchronous issue or something of the sort.</p>
  
  <p>This is the stack trace and related bits of code:</p>
  
  <pre><code>- RangeError: Maximum call stack size exceeded
          at getSuite (C:\Users\AutomationUser\application\admin\adminui\e2e\common-pages\reporter.js:248:26)
          at exportObject.QmetryReporter.self.suiteDone (C:\Users\AutomationUser\application\admin\adminui\e2e\common-pages\reporter.js:312:21)
          at exportObject.QmetryReporter.self.suiteDone (C:\Users\AutomationUser\application\admin\adminui\e2e\common-pages\reporter.js:322:22)
  </code></pre>
  
  <p><code>getSuite</code> function (line 248):</p>
  
  <pre><code>function getSuite(suite) {
      __suites[suite.id] = extend(__suites[suite.id] || {}, suite);
      return __suites[suite.id];
  }
  </code></pre>
  
  <p>Chunk of <code>suiteDone</code> function: </p>
  
  <pre><code>self.suiteDone = function (suite) {
      suite = getSuite(suite); // this is line 312 from stacktrace
      if (suite._parent === UNDEFINED) {
          // disabled suite (xdescribe) -- suiteStarted was never called
          self.suiteStarted(suite);
      }
      suite._endTime = new Date();
      currentSuite = suite._parent;
      // below this line is the start of jasmineDone function that I moved into this function
      if (currentSuite) {
          // focused spec (fit) -- suiteDone was never called
          self.suiteDone(fakeFocusedSuite); // this is line 322 from stacktrace
      }
  </code></pre>
  
  <p>The issue seems to only happen when running a larger grouping of test specs. If just running a single test file, I do not get the issue.</p>