Advice on Jasmine port settimeout in clearStack

136 views
Skip to first unread message

Bruce

unread,
Jun 26, 2014, 8:38:32 PM6/26/14
to jasmine...@googlegroups.com
Hi,
 
I am trying to port Jasmine to an environment that doesn't support setTimeout (or at least one that only accepts a string, not a function).
 
I expected some functionality to be unavailable but was happy if I could get some basic stuff which seems to work fine ... except in
 
    function clearStack(fn) {
      currentSpecCallbackDepth++;
      if (currentSpecCallbackDepth >= maximumSpecCallbackDepth) {
        currentSpecCallbackDepth = 0;
        realSetTimeout(fn, 0);
      } else {
        fn();
      }
    }
 
Because maximumSpecCallbackDepth has a value of 20 that becomes the limit of the number of specs I can have.
 
I don't really understand this code but as a work around I have moved maximumSpecCallbackDepth to a property of the jasmine object (there seemed to be others in the base function).  So I now have

j$.MAXIMUM_SPEC_CALLBACK_DEPTH which I can update in my bootstrape code, seems fine at 2000.

It would be nice if I didn't need to make this change each update to Jasmine and it seems to be good to remove the magic number 20 anyway but as I'm not sure about this code, I would appreciate some advice.

Thanks

Bruce

  
 
Reply all
Reply to author
Forward
0 new messages