@rstest/core 0.9.6 → 0.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -183,18 +183,14 @@ __webpack_require__.add({
183
183
  }
184
184
  module.exports = valueToString;
185
185
  },
186
- "../../node_modules/.pnpm/@sinonjs+fake-timers@15.2.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js" (__unused_rspack_module, exports, __webpack_require__) {
186
+ "../../node_modules/.pnpm/@sinonjs+fake-timers@15.3.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js" (__unused_rspack_module, exports, __webpack_require__) {
187
187
  const globalObject = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js").global;
188
188
  let timersModule, timersPromisesModule;
189
189
  try {
190
- timersModule = __webpack_require__("../../node_modules/.pnpm/timers-browserify@2.0.12/node_modules/timers-browserify/main.js");
190
+ timersModule = __webpack_require__("?4e05");
191
191
  } catch (e) {}
192
192
  try {
193
- timersPromisesModule = __webpack_require__(Object(function __rspack_missing_module() {
194
- var e = new Error("Cannot find module 'timers/promises'");
195
- e.code = 'MODULE_NOT_FOUND';
196
- throw e;
197
- }()));
193
+ timersPromisesModule = __webpack_require__("?7123");
198
194
  } catch (e) {}
199
195
  function withGlobal(_global) {
200
196
  const maxTimeout = Math.pow(2, 31) - 1;
@@ -252,12 +248,11 @@ __webpack_require__.add({
252
248
  if (Number.isFinite) return Number.isFinite(num);
253
249
  return isFinite(num);
254
250
  }
255
- let isNearInfiniteLimit = false;
256
251
  function checkIsNearInfiniteLimit(clock, i) {
257
- if (clock.loopLimit && i === clock.loopLimit - 1) isNearInfiniteLimit = true;
252
+ if (clock.loopLimit && i === clock.loopLimit - 1) clock.isNearInfiniteLimit = true;
258
253
  }
259
- function resetIsNearInfiniteLimit() {
260
- isNearInfiniteLimit = false;
254
+ function resetIsNearInfiniteLimit(clock) {
255
+ if (clock) clock.isNearInfiniteLimit = false;
261
256
  }
262
257
  function parseTime(str) {
263
258
  if (!str) return 0;
@@ -282,7 +277,7 @@ __webpack_require__.add({
282
277
  }
283
278
  function getEpoch(epoch) {
284
279
  if (!epoch) return 0;
285
- if ("function" == typeof epoch.getTime) return epoch.getTime();
280
+ if (epoch instanceof Date) return epoch.getTime();
286
281
  if ("number" == typeof epoch) return epoch;
287
282
  throw new TypeError("now should be milliseconds since UNIX epoch");
288
283
  }
@@ -382,19 +377,123 @@ __webpack_require__.add({
382
377
  }
383
378
  function runJobs(clock) {
384
379
  if (!clock.jobs) return;
380
+ const wasNearLimit = clock.isNearInfiniteLimit;
385
381
  for(let i = 0; i < clock.jobs.length; i++){
386
382
  const job = clock.jobs[i];
387
383
  job.func.apply(null, job.args);
388
384
  checkIsNearInfiniteLimit(clock, i);
389
385
  if (clock.loopLimit && i > clock.loopLimit) throw getInfiniteLoopError(clock, job);
390
386
  }
391
- resetIsNearInfiniteLimit();
387
+ if (!wasNearLimit) resetIsNearInfiniteLimit(clock);
392
388
  clock.jobs = [];
393
389
  }
390
+ class TimerHeap {
391
+ constructor(){
392
+ this.timers = [];
393
+ }
394
+ peek() {
395
+ return this.timers[0];
396
+ }
397
+ push(timer) {
398
+ this.timers.push(timer);
399
+ this.bubbleUp(this.timers.length - 1);
400
+ }
401
+ pop() {
402
+ if (0 === this.timers.length) return;
403
+ const first = this.timers[0];
404
+ const last = this.timers.pop();
405
+ if (this.timers.length > 0) {
406
+ this.timers[0] = last;
407
+ last.heapIndex = 0;
408
+ this.bubbleDown(0);
409
+ }
410
+ delete first.heapIndex;
411
+ return first;
412
+ }
413
+ remove(timer) {
414
+ const index = timer.heapIndex;
415
+ if (void 0 === index || this.timers[index] !== timer) return false;
416
+ const last = this.timers.pop();
417
+ if (timer !== last) {
418
+ this.timers[index] = last;
419
+ last.heapIndex = index;
420
+ if (compareTimers(last, timer) < 0) this.bubbleUp(index);
421
+ else this.bubbleDown(index);
422
+ }
423
+ delete timer.heapIndex;
424
+ return true;
425
+ }
426
+ bubbleUp(index) {
427
+ const timer = this.timers[index];
428
+ let currentIndex = index;
429
+ while(currentIndex > 0){
430
+ const parentIndex = Math.floor((currentIndex - 1) / 2);
431
+ const parent = this.timers[parentIndex];
432
+ if (compareTimers(timer, parent) < 0) {
433
+ this.timers[currentIndex] = parent;
434
+ parent.heapIndex = currentIndex;
435
+ currentIndex = parentIndex;
436
+ } else break;
437
+ }
438
+ this.timers[currentIndex] = timer;
439
+ timer.heapIndex = currentIndex;
440
+ }
441
+ bubbleDown(index) {
442
+ const timer = this.timers[index];
443
+ let currentIndex = index;
444
+ const halfLength = Math.floor(this.timers.length / 2);
445
+ while(currentIndex < halfLength){
446
+ const leftIndex = 2 * currentIndex + 1;
447
+ const rightIndex = leftIndex + 1;
448
+ let bestChildIndex = leftIndex;
449
+ let bestChild = this.timers[leftIndex];
450
+ if (rightIndex < this.timers.length && compareTimers(this.timers[rightIndex], bestChild) < 0) {
451
+ bestChildIndex = rightIndex;
452
+ bestChild = this.timers[rightIndex];
453
+ }
454
+ if (compareTimers(bestChild, timer) < 0) {
455
+ this.timers[currentIndex] = bestChild;
456
+ bestChild.heapIndex = currentIndex;
457
+ currentIndex = bestChildIndex;
458
+ } else break;
459
+ }
460
+ this.timers[currentIndex] = timer;
461
+ timer.heapIndex = currentIndex;
462
+ }
463
+ }
464
+ function ensureTimerState(clock) {
465
+ if (!clock.timers) {
466
+ clock.timers = new Map();
467
+ clock.timerHeap = new TimerHeap();
468
+ }
469
+ }
470
+ function hasTimer(clock, id) {
471
+ return clock.timers ? clock.timers.has(id) : false;
472
+ }
473
+ function getTimer(clock, id) {
474
+ return clock.timers ? clock.timers.get(id) : void 0;
475
+ }
476
+ function setTimer(clock, timer) {
477
+ ensureTimerState(clock);
478
+ clock.timers.set(timer.id, timer);
479
+ }
480
+ function deleteTimer(clock, id) {
481
+ return clock.timers ? clock.timers.delete(id) : false;
482
+ }
483
+ function forEachActiveTimer(clock, callback) {
484
+ if (!clock.timers) return;
485
+ for (const timer of clock.timers.values())callback(timer);
486
+ }
487
+ function rebuildTimerHeap(clock) {
488
+ clock.timerHeap = new TimerHeap();
489
+ forEachActiveTimer(clock, (timer)=>{
490
+ clock.timerHeap.push(timer);
491
+ });
492
+ }
394
493
  function addTimer(clock, timer) {
395
494
  if (void 0 === timer.func) throw new Error("Callback must be provided to timer calls");
396
495
  if ("function" != typeof timer.func) throw new TypeError(`[ERR_INVALID_CALLBACK]: Callback must be a function. Received ${timer.func} of type ${typeof timer.func}`);
397
- if (isNearInfiniteLimit) timer.error = new Error();
496
+ if (clock.isNearInfiniteLimit) timer.error = new Error();
398
497
  timer.type = timer.immediate ? "Immediate" : "Timeout";
399
498
  if (Object.prototype.hasOwnProperty.call(timer, "delay")) {
400
499
  if ("number" != typeof timer.delay) timer.delay = parseInt(timer.delay, 10);
@@ -414,11 +513,8 @@ __webpack_require__.add({
414
513
  if (!timer.delay) timer.type = "IdleCallback";
415
514
  timer.requestIdleCallback = true;
416
515
  }
417
- if (!clock.timers) {
418
- clock.timers = {};
419
- clock.timerHeap = new TimerHeap();
420
- }
421
- while(clock.timers && clock.timers[uniqueTimerId]){
516
+ ensureTimerState(clock);
517
+ while(hasTimer(clock, uniqueTimerId)){
422
518
  uniqueTimerId++;
423
519
  if (uniqueTimerId >= Number.MAX_SAFE_INTEGER) uniqueTimerId = idCounterStart;
424
520
  }
@@ -426,8 +522,8 @@ __webpack_require__.add({
426
522
  if (uniqueTimerId >= Number.MAX_SAFE_INTEGER) uniqueTimerId = idCounterStart;
427
523
  timer.order = uniqueTimerOrder++;
428
524
  timer.createdAt = clock.now;
429
- timer.callAt = clock.now + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0));
430
- clock.timers[timer.id] = timer;
525
+ timer.callAt = clock.now + (parseInt(String(timer.delay)) || (clock.duringTick ? 1 : 0));
526
+ setTimer(clock, timer);
431
527
  clock.timerHeap.push(timer);
432
528
  if (addTimerReturnsObject) {
433
529
  const res = {
@@ -444,10 +540,10 @@ __webpack_require__.add({
444
540
  return this.refed;
445
541
  },
446
542
  refresh: function() {
447
- timer.callAt = clock.now + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0));
543
+ timer.callAt = clock.now + (parseInt(String(timer.delay)) || (clock.duringTick ? 1 : 0));
448
544
  clock.timerHeap.remove(timer);
449
545
  timer.order = uniqueTimerOrder++;
450
- clock.timers[timer.id] = timer;
546
+ setTimer(clock, timer);
451
547
  clock.timerHeap.push(timer);
452
548
  return this;
453
549
  },
@@ -474,78 +570,6 @@ __webpack_require__.add({
474
570
  if (a.id > b.id) return 1;
475
571
  return 0;
476
572
  }
477
- function TimerHeap() {
478
- this.timers = [];
479
- }
480
- TimerHeap.prototype.peek = function() {
481
- return this.timers[0];
482
- };
483
- TimerHeap.prototype.push = function(timer) {
484
- this.timers.push(timer);
485
- this.bubbleUp(this.timers.length - 1);
486
- };
487
- TimerHeap.prototype.pop = function() {
488
- if (0 === this.timers.length) return;
489
- const first = this.timers[0];
490
- const last = this.timers.pop();
491
- if (this.timers.length > 0) {
492
- this.timers[0] = last;
493
- last.heapIndex = 0;
494
- this.bubbleDown(0);
495
- }
496
- delete first.heapIndex;
497
- return first;
498
- };
499
- TimerHeap.prototype.remove = function(timer) {
500
- const index = timer.heapIndex;
501
- if (void 0 === index || this.timers[index] !== timer) return false;
502
- const last = this.timers.pop();
503
- if (timer !== last) {
504
- this.timers[index] = last;
505
- last.heapIndex = index;
506
- if (compareTimers(last, timer) < 0) this.bubbleUp(index);
507
- else this.bubbleDown(index);
508
- }
509
- delete timer.heapIndex;
510
- return true;
511
- };
512
- TimerHeap.prototype.bubbleUp = function(index) {
513
- const timer = this.timers[index];
514
- let currentIndex = index;
515
- while(currentIndex > 0){
516
- const parentIndex = Math.floor((currentIndex - 1) / 2);
517
- const parent = this.timers[parentIndex];
518
- if (compareTimers(timer, parent) < 0) {
519
- this.timers[currentIndex] = parent;
520
- parent.heapIndex = currentIndex;
521
- currentIndex = parentIndex;
522
- } else break;
523
- }
524
- this.timers[currentIndex] = timer;
525
- timer.heapIndex = currentIndex;
526
- };
527
- TimerHeap.prototype.bubbleDown = function(index) {
528
- const timer = this.timers[index];
529
- let currentIndex = index;
530
- const halfLength = Math.floor(this.timers.length / 2);
531
- while(currentIndex < halfLength){
532
- const leftIndex = 2 * currentIndex + 1;
533
- const rightIndex = leftIndex + 1;
534
- let bestChildIndex = leftIndex;
535
- let bestChild = this.timers[leftIndex];
536
- if (rightIndex < this.timers.length && compareTimers(this.timers[rightIndex], bestChild) < 0) {
537
- bestChildIndex = rightIndex;
538
- bestChild = this.timers[rightIndex];
539
- }
540
- if (compareTimers(bestChild, timer) < 0) {
541
- this.timers[currentIndex] = bestChild;
542
- bestChild.heapIndex = currentIndex;
543
- currentIndex = bestChildIndex;
544
- } else break;
545
- }
546
- this.timers[currentIndex] = timer;
547
- timer.heapIndex = currentIndex;
548
- };
549
573
  function firstTimerInRange(clock, from, to) {
550
574
  if (!clock.timerHeap) return null;
551
575
  const timers = clock.timerHeap.timers;
@@ -572,9 +596,10 @@ __webpack_require__.add({
572
596
  clock.timerHeap.remove(timer);
573
597
  timer.callAt += timer.interval;
574
598
  timer.order = uniqueTimerOrder++;
599
+ if (clock.isNearInfiniteLimit) timer.error = new Error();
575
600
  clock.timerHeap.push(timer);
576
601
  } else {
577
- delete clock.timers[timer.id];
602
+ deleteTimer(clock, timer.id);
578
603
  clock.timerHeap.remove(timer);
579
604
  }
580
605
  if ("function" == typeof timer.func) timer.func.apply(null, timer.args);
@@ -596,7 +621,6 @@ __webpack_require__.add({
596
621
  const warnOnce = createWarnOnce();
597
622
  function clearTimer(clock, timerId, ttype) {
598
623
  if (!timerId) return;
599
- if (!clock.timers) clock.timers = {};
600
624
  const id = Number(timerId);
601
625
  if (Number.isNaN(id) || id < idCounterStart) {
602
626
  const handlerName = getClearHandler(ttype);
@@ -607,10 +631,10 @@ __webpack_require__.add({
607
631
  const stackTrace = new Error().stack.split("\n").slice(1).join("\n");
608
632
  warnOnce(`FakeTimers: ${handlerName} was invoked to clear a native timer instead of one created by this library.\nTo automatically clean-up native timers, use \`shouldClearNativeTimers\`.\n${stackTrace}`);
609
633
  }
610
- if (Object.prototype.hasOwnProperty.call(clock.timers, id)) {
611
- const timer = clock.timers[id];
634
+ if (hasTimer(clock, id)) {
635
+ const timer = getTimer(clock, id);
612
636
  if (timer.type === ttype || "Timeout" === timer.type && "Interval" === ttype || "Interval" === timer.type && "Timeout" === ttype) {
613
- delete clock.timers[id];
637
+ deleteTimer(clock, id);
614
638
  clock.timerHeap.remove(timer);
615
639
  } else {
616
640
  const clear = getClearHandler(ttype);
@@ -644,7 +668,9 @@ __webpack_require__.add({
644
668
  timersPromisesModule[entry.methodName] = entry.original;
645
669
  }
646
670
  }
647
- clock.setTickMode("manual");
671
+ clock.setTickMode({
672
+ mode: "manual"
673
+ });
648
674
  clock.methods = [];
649
675
  for (const [listener, signal] of clock.abortListenerMap.entries()){
650
676
  signal.removeEventListener("abort", listener);
@@ -709,6 +735,7 @@ __webpack_require__.add({
709
735
  now: start,
710
736
  Date: createDate(),
711
737
  loopLimit: loopLimit,
738
+ isNearInfiniteLimit: false,
712
739
  tickMode: {
713
740
  mode: "manual",
714
741
  counter: 0,
@@ -773,7 +800,7 @@ __webpack_require__.add({
773
800
  const channel = new MessageChannel();
774
801
  await new Promise((resolve)=>{
775
802
  channel.port1.onmessage = ()=>{
776
- resolve();
803
+ resolve(void 0);
777
804
  channel.port1.close();
778
805
  };
779
806
  channel.port2.postMessage(void 0);
@@ -825,7 +852,7 @@ __webpack_require__.add({
825
852
  clock.cancelIdleCallback = function cancelIdleCallback(timerId) {
826
853
  return clearTimer(clock, timerId, "IdleCallback");
827
854
  };
828
- clock.setTimeout = function setTimeout1(func, timeout) {
855
+ clock.setTimeout = function setTimeout(func, timeout) {
829
856
  return addTimer(clock, {
830
857
  func: func,
831
858
  args: Array.prototype.slice.call(arguments, 2),
@@ -843,20 +870,20 @@ __webpack_require__.add({
843
870
  });
844
871
  });
845
872
  };
846
- clock.clearTimeout = function clearTimeout1(timerId) {
873
+ clock.clearTimeout = function clearTimeout(timerId) {
847
874
  return clearTimer(clock, timerId, "Timeout");
848
875
  };
849
876
  clock.nextTick = function nextTick(func) {
850
877
  return enqueueJob(clock, {
851
878
  func: func,
852
879
  args: Array.prototype.slice.call(arguments, 1),
853
- error: isNearInfiniteLimit ? new Error() : null
880
+ error: clock.isNearInfiniteLimit ? new Error() : null
854
881
  });
855
882
  };
856
883
  clock.queueMicrotask = function queueMicrotask(func) {
857
884
  return clock.nextTick(func);
858
885
  };
859
- clock.setInterval = function setInterval1(func, timeout) {
886
+ clock.setInterval = function setInterval(func, timeout) {
860
887
  timeout = parseInt(timeout, 10);
861
888
  return addTimer(clock, {
862
889
  func: func,
@@ -865,7 +892,7 @@ __webpack_require__.add({
865
892
  interval: timeout
866
893
  });
867
894
  };
868
- clock.clearInterval = function clearInterval1(timerId) {
895
+ clock.clearInterval = function clearInterval(timerId) {
869
896
  return clearTimer(clock, timerId, "Interval");
870
897
  };
871
898
  if (isPresent.setImmediate) {
@@ -913,7 +940,7 @@ __webpack_require__.add({
913
940
  clock.runMicrotasks = function runMicrotasks() {
914
941
  runJobs(clock);
915
942
  };
916
- function doTick(tickValue, isAsync, resolve, reject) {
943
+ function createTickState(tickValue) {
917
944
  const msFloat = "number" == typeof tickValue ? tickValue : parseTime(tickValue);
918
945
  const ms = Math.floor(msFloat);
919
946
  const remainder = nanoRemainder(msFloat);
@@ -924,92 +951,108 @@ __webpack_require__.add({
924
951
  tickTo += 1;
925
952
  nanosTotal -= 1e6;
926
953
  }
927
- nanos = nanosTotal;
928
- let tickFrom = clock.now;
929
- let previous = clock.now;
930
- let timer, firstException, oldNow, nextPromiseTick, compensationCheck, postTimerCall;
931
- clock.duringTick = true;
932
- oldNow = clock.now;
933
- runJobs(clock);
954
+ return {
955
+ msFloat: msFloat,
956
+ ms: ms,
957
+ nanosTotal: nanosTotal,
958
+ tickFrom: clock.now,
959
+ tickTo: tickTo,
960
+ previous: clock.now,
961
+ timer: null,
962
+ firstException: null,
963
+ oldNow: null
964
+ };
965
+ }
966
+ function applyClockChangeCompensation(state, oldNow, options) {
934
967
  if (oldNow !== clock.now) {
935
- tickFrom += clock.now - oldNow;
936
- tickTo += clock.now - oldNow;
968
+ const difference = clock.now - oldNow;
969
+ state.tickFrom += difference;
970
+ state.tickTo += difference;
971
+ if (options && options.includePrevious) state.previous += difference;
937
972
  }
938
- function doTickInner() {
939
- timer = firstTimerInRange(clock, tickFrom, tickTo);
940
- while(timer && tickFrom <= tickTo){
941
- if (clock.timers[timer.id]) {
942
- tickFrom = timer.callAt;
943
- clock.now = timer.callAt;
944
- oldNow = clock.now;
945
- try {
946
- runJobs(clock);
947
- callTimer(clock, timer);
948
- } catch (e) {
949
- firstException = firstException || e;
950
- }
951
- if (isAsync) return void originalSetTimeout(nextPromiseTick);
952
- compensationCheck();
973
+ }
974
+ function runInitialJobs(state) {
975
+ state.oldNow = clock.now;
976
+ runJobs(clock);
977
+ applyClockChangeCompensation(state, state.oldNow);
978
+ }
979
+ function runPostLoopJobs(state) {
980
+ state.oldNow = clock.now;
981
+ runJobs(clock);
982
+ applyClockChangeCompensation(state, state.oldNow);
983
+ }
984
+ function selectNextTimerInRange(state) {
985
+ state.timer = firstTimerInRange(clock, state.previous, state.tickTo);
986
+ state.previous = state.tickFrom;
987
+ }
988
+ function runTimersInRange(state, isAsync, nextPromiseTick, compensationCheck) {
989
+ state.timer = firstTimerInRange(clock, state.tickFrom, state.tickTo);
990
+ while(state.timer && state.tickFrom <= state.tickTo){
991
+ if (hasTimer(clock, state.timer.id)) {
992
+ state.tickFrom = state.timer.callAt;
993
+ clock.now = state.timer.callAt;
994
+ state.oldNow = clock.now;
995
+ try {
996
+ runJobs(clock);
997
+ callTimer(clock, state.timer);
998
+ } catch (e) {
999
+ state.firstException = state.firstException || e;
953
1000
  }
954
- postTimerCall();
955
- }
956
- oldNow = clock.now;
957
- runJobs(clock);
958
- if (oldNow !== clock.now) {
959
- tickFrom += clock.now - oldNow;
960
- tickTo += clock.now - oldNow;
961
- }
962
- clock.duringTick = false;
963
- timer = firstTimerInRange(clock, tickFrom, tickTo);
964
- if (timer) try {
965
- clock.tick(tickTo - clock.now);
966
- } catch (e) {
967
- firstException = firstException || e;
968
- }
969
- else {
970
- clock.now = tickTo;
971
- nanos = nanosTotal;
1001
+ if (isAsync) {
1002
+ originalSetTimeout(nextPromiseTick);
1003
+ return true;
1004
+ }
1005
+ compensationCheck();
972
1006
  }
973
- if (firstException) throw firstException;
974
- if (!isAsync) return clock.now;
975
- resolve(clock.now);
1007
+ selectNextTimerInRange(state);
1008
+ }
1009
+ return false;
1010
+ }
1011
+ function finalizeTick(state, isAsync, resolve) {
1012
+ state.timer = firstTimerInRange(clock, state.tickFrom, state.tickTo);
1013
+ if (state.timer) try {
1014
+ clock.tick(state.tickTo - clock.now);
1015
+ } catch (e) {
1016
+ state.firstException = state.firstException || e;
1017
+ }
1018
+ else {
1019
+ clock.now = state.tickTo;
1020
+ nanos = state.nanosTotal;
976
1021
  }
977
- nextPromiseTick = isAsync && function() {
1022
+ if (state.firstException) throw state.firstException;
1023
+ if (!isAsync) return clock.now;
1024
+ resolve(clock.now);
1025
+ }
1026
+ function doTick(tickValue, isAsync, resolve, reject) {
1027
+ const state = createTickState(tickValue);
1028
+ nanos = state.nanosTotal;
1029
+ clock.duringTick = true;
1030
+ runInitialJobs(state);
1031
+ const compensationCheck = function() {
1032
+ applyClockChangeCompensation(state, state.oldNow, {
1033
+ includePrevious: true
1034
+ });
1035
+ };
1036
+ const nextPromiseTick = isAsync && function() {
978
1037
  try {
979
1038
  compensationCheck();
980
- postTimerCall();
1039
+ selectNextTimerInRange(state);
981
1040
  doTickInner();
982
1041
  } catch (e) {
983
1042
  reject(e);
984
1043
  }
985
1044
  };
986
- compensationCheck = function() {
987
- if (oldNow !== clock.now) {
988
- tickFrom += clock.now - oldNow;
989
- tickTo += clock.now - oldNow;
990
- previous += clock.now - oldNow;
991
- }
992
- };
993
- postTimerCall = function() {
994
- timer = firstTimerInRange(clock, previous, tickTo);
995
- previous = tickFrom;
996
- };
1045
+ function doTickInner() {
1046
+ if (runTimersInRange(state, isAsync, nextPromiseTick, compensationCheck)) return;
1047
+ runPostLoopJobs(state);
1048
+ clock.duringTick = false;
1049
+ return finalizeTick(state, isAsync, resolve);
1050
+ }
997
1051
  return doTickInner();
998
1052
  }
999
1053
  clock.tick = function tick(tickValue) {
1000
1054
  return doTick(tickValue, false);
1001
1055
  };
1002
- if (void 0 !== _global.Promise) clock.tickAsync = function tickAsync(tickValue) {
1003
- return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
1004
- originalSetTimeout(function() {
1005
- try {
1006
- doTick(tickValue, true, resolve, reject);
1007
- } catch (e) {
1008
- reject(e);
1009
- }
1010
- });
1011
- }));
1012
- };
1013
1056
  clock.next = function next() {
1014
1057
  runJobs(clock);
1015
1058
  const timer = firstTimer(clock);
@@ -1024,46 +1067,31 @@ __webpack_require__.add({
1024
1067
  clock.duringTick = false;
1025
1068
  }
1026
1069
  };
1027
- if (void 0 !== _global.Promise) clock.nextAsync = function nextAsync() {
1070
+ function runAsyncWithNativeTimeout(callback) {
1028
1071
  return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
1029
1072
  originalSetTimeout(function() {
1030
1073
  try {
1031
- const timer = firstTimer(clock);
1032
- if (!timer) return void resolve(clock.now);
1033
- let err;
1034
- clock.duringTick = true;
1035
- clock.now = timer.callAt;
1036
- try {
1037
- callTimer(clock, timer);
1038
- } catch (e) {
1039
- err = e;
1040
- }
1041
- clock.duringTick = false;
1042
- originalSetTimeout(function() {
1043
- if (err) reject(err);
1044
- else resolve(clock.now);
1045
- });
1074
+ callback(resolve, reject);
1046
1075
  } catch (e) {
1047
1076
  reject(e);
1048
1077
  }
1049
1078
  });
1050
1079
  }));
1051
- };
1080
+ }
1052
1081
  clock.runAll = function runAll() {
1053
- let numTimers, i;
1054
1082
  runJobs(clock);
1055
- for(i = 0; i < clock.loopLimit; i++){
1083
+ for(let i = 0; i < clock.loopLimit; i++){
1056
1084
  if (!clock.timers) {
1057
- resetIsNearInfiniteLimit();
1085
+ resetIsNearInfiniteLimit(clock);
1058
1086
  return clock.now;
1059
1087
  }
1060
- numTimers = clock.timerHeap.timers.length;
1088
+ const numTimers = clock.timerHeap.timers.length;
1061
1089
  if (0 === numTimers) {
1062
- resetIsNearInfiniteLimit();
1090
+ resetIsNearInfiniteLimit(clock);
1063
1091
  return clock.now;
1064
1092
  }
1065
- clock.next();
1066
1093
  checkIsNearInfiniteLimit(clock, i);
1094
+ clock.next();
1067
1095
  }
1068
1096
  const excessJob = firstTimer(clock);
1069
1097
  throw getInfiniteLoopError(clock, excessJob);
@@ -1071,42 +1099,6 @@ __webpack_require__.add({
1071
1099
  clock.runToFrame = function runToFrame() {
1072
1100
  return clock.tick(getTimeToNextFrame());
1073
1101
  };
1074
- if (void 0 !== _global.Promise) clock.runAllAsync = function runAllAsync() {
1075
- return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
1076
- let i = 0;
1077
- function doRun() {
1078
- originalSetTimeout(function() {
1079
- try {
1080
- runJobs(clock);
1081
- let numTimers;
1082
- if (i < clock.loopLimit) {
1083
- if (!clock.timerHeap) {
1084
- resetIsNearInfiniteLimit();
1085
- resolve(clock.now);
1086
- return;
1087
- }
1088
- numTimers = clock.timerHeap.timers.length;
1089
- if (0 === numTimers) {
1090
- resetIsNearInfiniteLimit();
1091
- resolve(clock.now);
1092
- return;
1093
- }
1094
- clock.next();
1095
- i++;
1096
- doRun();
1097
- checkIsNearInfiniteLimit(clock, i);
1098
- return;
1099
- }
1100
- const excessJob = firstTimer(clock);
1101
- reject(getInfiniteLoopError(clock, excessJob));
1102
- } catch (e) {
1103
- reject(e);
1104
- }
1105
- });
1106
- }
1107
- doRun();
1108
- }));
1109
- };
1110
1102
  clock.runToLast = function runToLast() {
1111
1103
  const timer = lastTimer(clock);
1112
1104
  if (!timer) {
@@ -1115,25 +1107,82 @@ __webpack_require__.add({
1115
1107
  }
1116
1108
  return clock.tick(timer.callAt - clock.now);
1117
1109
  };
1118
- if (void 0 !== _global.Promise) clock.runToLastAsync = function runToLastAsync() {
1119
- return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
1120
- originalSetTimeout(function() {
1110
+ if (void 0 !== _global.Promise) {
1111
+ clock.tickAsync = function tickAsync(tickValue) {
1112
+ return runAsyncWithNativeTimeout(function(resolve, reject) {
1113
+ doTick(tickValue, true, resolve, reject);
1114
+ });
1115
+ };
1116
+ clock.nextAsync = function nextAsync() {
1117
+ return runAsyncWithNativeTimeout(function(resolve, reject) {
1118
+ const timer = firstTimer(clock);
1119
+ if (!timer) return void resolve(clock.now);
1120
+ let err;
1121
+ clock.duringTick = true;
1122
+ clock.now = timer.callAt;
1121
1123
  try {
1122
- const timer = lastTimer(clock);
1123
- if (!timer) {
1124
- runJobs(clock);
1125
- resolve(clock.now);
1124
+ callTimer(clock, timer);
1125
+ } catch (e) {
1126
+ err = e;
1127
+ }
1128
+ clock.duringTick = false;
1129
+ originalSetTimeout(function() {
1130
+ if (err) reject(err);
1131
+ else resolve(clock.now);
1132
+ });
1133
+ });
1134
+ };
1135
+ clock.runAllAsync = function runAllAsync() {
1136
+ let i = 0;
1137
+ function doRun(resolve, reject) {
1138
+ try {
1139
+ runJobs(clock);
1140
+ let numTimers;
1141
+ if (i < clock.loopLimit) {
1142
+ if (!clock.timerHeap) {
1143
+ resetIsNearInfiniteLimit(clock);
1144
+ resolve(clock.now);
1145
+ return;
1146
+ }
1147
+ numTimers = clock.timerHeap.timers.length;
1148
+ if (0 === numTimers) {
1149
+ resetIsNearInfiniteLimit(clock);
1150
+ resolve(clock.now);
1151
+ return;
1152
+ }
1153
+ checkIsNearInfiniteLimit(clock, i);
1154
+ clock.next();
1155
+ i++;
1156
+ originalSetTimeout(function() {
1157
+ doRun(resolve, reject);
1158
+ });
1159
+ return;
1126
1160
  }
1127
- resolve(clock.tickAsync(timer.callAt - clock.now));
1161
+ const excessJob = firstTimer(clock);
1162
+ reject(getInfiniteLoopError(clock, excessJob));
1128
1163
  } catch (e) {
1129
1164
  reject(e);
1130
1165
  }
1166
+ }
1167
+ return runAsyncWithNativeTimeout(function(resolve, reject) {
1168
+ doRun(resolve, reject);
1131
1169
  });
1132
- }));
1133
- };
1170
+ };
1171
+ clock.runToLastAsync = function runToLastAsync() {
1172
+ return runAsyncWithNativeTimeout(function(resolve) {
1173
+ const timer = lastTimer(clock);
1174
+ if (!timer) {
1175
+ runJobs(clock);
1176
+ resolve(clock.now);
1177
+ return;
1178
+ }
1179
+ resolve(clock.tickAsync(timer.callAt - clock.now));
1180
+ });
1181
+ };
1182
+ }
1134
1183
  clock.reset = function reset() {
1135
1184
  nanos = 0;
1136
- clock.timers = {};
1185
+ clock.timers = new Map();
1137
1186
  clock.timerHeap = new TimerHeap();
1138
1187
  clock.jobs = [];
1139
1188
  clock.now = start;
@@ -1141,25 +1190,22 @@ __webpack_require__.add({
1141
1190
  clock.setSystemTime = function setSystemTime(systemTime) {
1142
1191
  const newNow = getEpoch(systemTime);
1143
1192
  const difference = newNow - clock.now;
1144
- let id, timer;
1145
1193
  adjustedSystemTime[0] = adjustedSystemTime[0] + difference;
1146
1194
  adjustedSystemTime[1] = adjustedSystemTime[1] + nanos;
1147
1195
  clock.now = newNow;
1148
1196
  nanos = 0;
1149
- for(id in clock.timers)if (Object.prototype.hasOwnProperty.call(clock.timers, id)) {
1150
- timer = clock.timers[id];
1197
+ forEachActiveTimer(clock, (timer)=>{
1151
1198
  timer.createdAt += difference;
1152
1199
  timer.callAt += difference;
1153
- }
1200
+ });
1154
1201
  };
1155
1202
  clock.jump = function jump(tickValue) {
1156
1203
  const msFloat = "number" == typeof tickValue ? tickValue : parseTime(tickValue);
1157
1204
  const ms = Math.floor(msFloat);
1158
- if (clock.timers) {
1159
- for (const timer of Object.values(clock.timers))if (clock.now + ms > timer.callAt) timer.callAt = clock.now + ms;
1160
- clock.timerHeap = new TimerHeap();
1161
- for (const timer of Object.values(clock.timers))clock.timerHeap.push(timer);
1162
- }
1205
+ forEachActiveTimer(clock, (timer)=>{
1206
+ if (clock.now + ms > timer.callAt) timer.callAt = clock.now + ms;
1207
+ });
1208
+ rebuildTimerHeap(clock);
1163
1209
  clock.tick(ms);
1164
1210
  return clock.now;
1165
1211
  };
@@ -1220,7 +1266,7 @@ __webpack_require__.add({
1220
1266
  clock.performance.mark = (name)=>new FakePerformanceEntry(name, "mark", 0, 0);
1221
1267
  clock.performance.measure = (name)=>new FakePerformanceEntry(name, "measure", 0, 100);
1222
1268
  clock.performance.timeOrigin = getEpoch(config.now);
1223
- } else if ((config.toFake || []).includes("performance")) return handleMissingTimer("performance");
1269
+ } else if ((config.toFake || []).includes("performance")) handleMissingTimer("performance");
1224
1270
  }
1225
1271
  if (_global === globalObject && timersModule) clock.timersModuleMethods = [];
1226
1272
  if (_global === globalObject && timersPromisesModule) clock.timersPromisesModuleMethods = [];
@@ -1407,175 +1453,6 @@ __webpack_require__.add({
1407
1453
  defaultImplementation.install;
1408
1454
  exports.withGlobal = withGlobal;
1409
1455
  },
1410
- "../../node_modules/.pnpm/setimmediate@1.0.5/node_modules/setimmediate/setImmediate.js" (__unused_rspack_module, __unused_rspack_exports, __webpack_require__) {
1411
- var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
1412
- (function(global, undefined) {
1413
- "use strict";
1414
- if (global.setImmediate) return;
1415
- var nextHandle = 1;
1416
- var tasksByHandle = {};
1417
- var currentlyRunningATask = false;
1418
- var doc = global.document;
1419
- var registerImmediate;
1420
- function setImmediate(callback) {
1421
- if ("function" != typeof callback) callback = new Function("" + callback);
1422
- var args = new Array(arguments.length - 1);
1423
- for(var i = 0; i < args.length; i++)args[i] = arguments[i + 1];
1424
- var task = {
1425
- callback: callback,
1426
- args: args
1427
- };
1428
- tasksByHandle[nextHandle] = task;
1429
- registerImmediate(nextHandle);
1430
- return nextHandle++;
1431
- }
1432
- function clearImmediate(handle) {
1433
- delete tasksByHandle[handle];
1434
- }
1435
- function run(task) {
1436
- var callback = task.callback;
1437
- var args = task.args;
1438
- switch(args.length){
1439
- case 0:
1440
- callback();
1441
- break;
1442
- case 1:
1443
- callback(args[0]);
1444
- break;
1445
- case 2:
1446
- callback(args[0], args[1]);
1447
- break;
1448
- case 3:
1449
- callback(args[0], args[1], args[2]);
1450
- break;
1451
- default:
1452
- callback.apply(undefined, args);
1453
- break;
1454
- }
1455
- }
1456
- function runIfPresent(handle) {
1457
- if (currentlyRunningATask) setTimeout(runIfPresent, 0, handle);
1458
- else {
1459
- var task = tasksByHandle[handle];
1460
- if (task) {
1461
- currentlyRunningATask = true;
1462
- try {
1463
- run(task);
1464
- } finally{
1465
- clearImmediate(handle);
1466
- currentlyRunningATask = false;
1467
- }
1468
- }
1469
- }
1470
- }
1471
- function installNextTickImplementation() {
1472
- registerImmediate = function(handle) {
1473
- process.nextTick(function() {
1474
- runIfPresent(handle);
1475
- });
1476
- };
1477
- }
1478
- function canUsePostMessage() {
1479
- if (global.postMessage && !global.importScripts) {
1480
- var postMessageIsAsynchronous = true;
1481
- var oldOnMessage = global.onmessage;
1482
- global.onmessage = function() {
1483
- postMessageIsAsynchronous = false;
1484
- };
1485
- global.postMessage("", "*");
1486
- global.onmessage = oldOnMessage;
1487
- return postMessageIsAsynchronous;
1488
- }
1489
- }
1490
- function installPostMessageImplementation() {
1491
- var messagePrefix = "setImmediate$" + Math.random() + "$";
1492
- var onGlobalMessage = function(event) {
1493
- if (event.source === global && "string" == typeof event.data && 0 === event.data.indexOf(messagePrefix)) runIfPresent(+event.data.slice(messagePrefix.length));
1494
- };
1495
- if (global.addEventListener) global.addEventListener("message", onGlobalMessage, false);
1496
- else global.attachEvent("onmessage", onGlobalMessage);
1497
- registerImmediate = function(handle) {
1498
- global.postMessage(messagePrefix + handle, "*");
1499
- };
1500
- }
1501
- function installMessageChannelImplementation() {
1502
- var channel = new MessageChannel();
1503
- channel.port1.onmessage = function(event) {
1504
- var handle = event.data;
1505
- runIfPresent(handle);
1506
- };
1507
- registerImmediate = function(handle) {
1508
- channel.port2.postMessage(handle);
1509
- };
1510
- }
1511
- function installReadyStateChangeImplementation() {
1512
- var html = doc.documentElement;
1513
- registerImmediate = function(handle) {
1514
- var script = doc.createElement("script");
1515
- script.onreadystatechange = function() {
1516
- runIfPresent(handle);
1517
- script.onreadystatechange = null;
1518
- html.removeChild(script);
1519
- script = null;
1520
- };
1521
- html.appendChild(script);
1522
- };
1523
- }
1524
- function installSetTimeoutImplementation() {
1525
- registerImmediate = function(handle) {
1526
- setTimeout(runIfPresent, 0, handle);
1527
- };
1528
- }
1529
- var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
1530
- attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
1531
- if ("[object process]" === ({}).toString.call(global.process)) installNextTickImplementation();
1532
- else if (canUsePostMessage()) installPostMessageImplementation();
1533
- else if (global.MessageChannel) installMessageChannelImplementation();
1534
- else if (doc && "onreadystatechange" in doc.createElement("script")) installReadyStateChangeImplementation();
1535
- else installSetTimeoutImplementation();
1536
- attachTo.setImmediate = setImmediate;
1537
- attachTo.clearImmediate = clearImmediate;
1538
- })("u" < typeof self ? void 0 === __webpack_require__.g ? this : __webpack_require__.g : self);
1539
- },
1540
- "../../node_modules/.pnpm/timers-browserify@2.0.12/node_modules/timers-browserify/main.js" (__unused_rspack_module, exports, __webpack_require__) {
1541
- var scope = void 0 !== __webpack_require__.g && __webpack_require__.g || "u" > typeof self && self || window;
1542
- var apply = Function.prototype.apply;
1543
- exports.setTimeout = function() {
1544
- return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
1545
- };
1546
- exports.setInterval = function() {
1547
- return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
1548
- };
1549
- exports.clearTimeout = exports.clearInterval = function(timeout) {
1550
- if (timeout) timeout.close();
1551
- };
1552
- function Timeout(id, clearFn) {
1553
- this._id = id;
1554
- this._clearFn = clearFn;
1555
- }
1556
- Timeout.prototype.unref = Timeout.prototype.ref = function() {};
1557
- Timeout.prototype.close = function() {
1558
- this._clearFn.call(scope, this._id);
1559
- };
1560
- exports.enroll = function(item, msecs) {
1561
- clearTimeout(item._idleTimeoutId);
1562
- item._idleTimeout = msecs;
1563
- };
1564
- exports.unenroll = function(item) {
1565
- clearTimeout(item._idleTimeoutId);
1566
- item._idleTimeout = -1;
1567
- };
1568
- exports._unrefActive = exports.active = function(item) {
1569
- clearTimeout(item._idleTimeoutId);
1570
- var msecs = item._idleTimeout;
1571
- if (msecs >= 0) item._idleTimeoutId = setTimeout(function onTimeout() {
1572
- if (item._onTimeout) item._onTimeout();
1573
- }, msecs);
1574
- };
1575
- __webpack_require__("../../node_modules/.pnpm/setimmediate@1.0.5/node_modules/setimmediate/setImmediate.js");
1576
- exports.setImmediate = "u" > typeof self && self.setImmediate || void 0 !== __webpack_require__.g && __webpack_require__.g.setImmediate || this && this.setImmediate;
1577
- exports.clearImmediate = "u" > typeof self && self.clearImmediate || void 0 !== __webpack_require__.g && __webpack_require__.g.clearImmediate || this && this.clearImmediate;
1578
- },
1579
1456
  "../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js" (module, __unused_rspack_exports, __webpack_require__) {
1580
1457
  (function(global, factory) {
1581
1458
  module.exports = factory();
@@ -1640,12 +1517,14 @@ __webpack_require__.add({
1640
1517
  }
1641
1518
  return typeDetect;
1642
1519
  });
1643
- }
1520
+ },
1521
+ "?4e05" () {},
1522
+ "?7123" () {}
1644
1523
  });
1645
1524
  var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
1646
1525
  const RealDate = Date;
1647
1526
  const loadFakeTimersModule = ()=>{
1648
- const loaded = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@15.2.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js");
1527
+ const loaded = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@15.3.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js");
1649
1528
  return {
1650
1529
  withGlobal: loaded.withGlobal
1651
1530
  };
@@ -1712,7 +1591,7 @@ class FakeTimers {
1712
1591
  }
1713
1592
  useFakeTimers(fakeTimersConfig = {}) {
1714
1593
  if (this._fakingTime) this._clock.uninstall();
1715
- const toFake = Object.keys(this._fakeTimers.timers).filter((timer)=>'nextTick' !== timer && 'queueMicrotask' !== timer);
1594
+ const toFake = Object.keys(this._fakeTimers.timers).filter((timer)=>'Intl' !== timer && 'nextTick' !== timer && 'queueMicrotask' !== timer);
1716
1595
  const isChildProcess = void 0 !== process && !!process.send;
1717
1596
  if (this._config?.toFake?.includes('nextTick') && isChildProcess) throw new Error('process.nextTick cannot be mocked inside child_process');
1718
1597
  this._clock = this._fakeTimers.install({