Skip to content

Commit

Permalink
fix: handle missing stack when throwing recursion errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 22, 2021
1 parent f434b69 commit d983958
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/fake-timers-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const globalObject = require("@sinonjs/commons").global;
* @property {number} createdAt
* @property {boolean} immediate
* @property {number} id
* @property {Error} [error]
*/

/**
Expand Down Expand Up @@ -208,8 +209,8 @@ function withGlobal(_global) {
let isNearInfiniteLimit = false;

/**
* @param clock
* @param i
* @param {Clock} clock
* @param {number} i
*/
function checkIsNearInfiniteLimit(clock, i) {
if (clock.loopLimit && i === clock.loopLimit - 1) {
Expand Down Expand Up @@ -309,14 +310,18 @@ function withGlobal(_global) {
}

/**
* @param clock
* @param job
* @param {Clock} clock
* @param {Timer} job
*/
function getInfiniteLoopError(clock, job) {
const infiniteLoopError = new Error(
`Aborting after running ${clock.loopLimit} timers, assuming an infinite loop!`
);

if (!job.error) {
return infiniteLoopError
}

// pattern never matched in Node
const computedTargetPattern = /target\.*[<|(|[].*?[>|\]|)]\s*/;
let clockMethodPattern = new RegExp(
Expand Down

0 comments on commit d983958

Please sign in to comment.