I am using a modified version of Jasmine JUnit Reports (found here: https://github.com/angular/protractor-cookbook/tree/master/jasmine-junit-reports) and am getting an error for RangeError: Maximum call stack size exceeded
The reason I modified the report is that I needed the xml reports generated at the suiteDone step, not the jasmineDone step. So basically I moved all the code from jasmineDone into suiteDone 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.
This is the stack trace and related bits of 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)
getSuite function (line 248):
function getSuite(suite) {
__suites[suite.id] = extend(__suites[suite.id] || {}, suite);
return __suites[suite.id];
}
Chunk of suiteDone function:
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
}
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.
I've run into this plenty of times. The solution that works for me is to use the increase-memory-limit package. Just install it globally and then run
increase-memory-limitin the root of your project (where yourpackage.jsonis). You should run this command after you have installed all your dependencies and before you start the tests. You will see a bunch of output that looks similar to the followingAfter that, you shouldn't see this error again. My full regression suite is very large and I used to always see the same error when I tried to run the full suite all at once. The above packaged fixed it for me and I haven't had an issue since I started using it.