@hughescr/stryker-bun-runner 1.3.8 → 1.4.0

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.
package/dist/index.js CHANGED
@@ -18,13 +18,15 @@ var __toESM = (mod, isNodeMode, target) => {
18
18
  return cached;
19
19
  }
20
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- for (let key of __getOwnPropNames(mod))
23
- if (!__hasOwnProp.call(to, key))
24
- __defProp(to, key, {
25
- get: __accessProp.bind(mod, key),
26
- enumerable: true
27
- });
21
+ const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ if (mod && typeof mod === "object" || typeof mod === "function") {
23
+ for (let key of __getOwnPropNames(mod))
24
+ if (!__hasOwnProp.call(to, key))
25
+ __defProp(to, key, {
26
+ get: __accessProp.bind(mod, key),
27
+ enumerable: true
28
+ });
29
+ }
28
30
  if (canCache)
29
31
  cache.set(mod, to);
30
32
  return to;
@@ -33,7 +35,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
33
35
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
34
36
 
35
37
  // node_modules/picomatch/lib/constants.js
36
- var require_constants = __commonJS((exports, module) => {
38
+ var require_constants = __commonJS(function(exports, module) {
37
39
  var WIN_SLASH = "\\\\/";
38
40
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
39
41
  var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
@@ -178,7 +180,7 @@ var require_constants = __commonJS((exports, module) => {
178
180
  });
179
181
 
180
182
  // node_modules/picomatch/lib/utils.js
181
- var require_utils = __commonJS((exports) => {
183
+ var require_utils = __commonJS(function(exports) {
182
184
  var {
183
185
  REGEX_BACKSLASH,
184
186
  REGEX_REMOVE_BACKSLASH,
@@ -241,7 +243,7 @@ var require_utils = __commonJS((exports) => {
241
243
  });
242
244
 
243
245
  // node_modules/picomatch/lib/scan.js
244
- var require_scan = __commonJS((exports, module) => {
246
+ var require_scan = __commonJS(function(exports, module) {
245
247
  var utils = require_utils();
246
248
  var {
247
249
  CHAR_ASTERISK,
@@ -273,7 +275,7 @@ var require_scan = __commonJS((exports, module) => {
273
275
  const length = input.length - 1;
274
276
  const scanToEnd = opts.parts === true || opts.scanToEnd === true;
275
277
  const slashes = [];
276
- const tokens3 = [];
278
+ const tokens = [];
277
279
  const parts = [];
278
280
  let str = input;
279
281
  let index = -1;
@@ -357,7 +359,7 @@ var require_scan = __commonJS((exports, module) => {
357
359
  }
358
360
  if (code === CHAR_FORWARD_SLASH) {
359
361
  slashes.push(index);
360
- tokens3.push(token);
362
+ tokens.push(token);
361
363
  token = { value: "", depth: 0, isGlob: false };
362
364
  if (finished === true)
363
365
  continue;
@@ -513,9 +515,9 @@ var require_scan = __commonJS((exports, module) => {
513
515
  if (opts.tokens === true) {
514
516
  state.maxDepth = 0;
515
517
  if (!isPathSeparator(code)) {
516
- tokens3.push(token);
518
+ tokens.push(token);
517
519
  }
518
- state.tokens = tokens3;
520
+ state.tokens = tokens;
519
521
  }
520
522
  if (opts.parts === true || opts.tokens === true) {
521
523
  let prevIndex;
@@ -525,13 +527,13 @@ var require_scan = __commonJS((exports, module) => {
525
527
  const value = input.slice(n, i);
526
528
  if (opts.tokens) {
527
529
  if (idx === 0 && start !== 0) {
528
- tokens3[idx].isPrefix = true;
529
- tokens3[idx].value = prefix;
530
+ tokens[idx].isPrefix = true;
531
+ tokens[idx].value = prefix;
530
532
  } else {
531
- tokens3[idx].value = value;
533
+ tokens[idx].value = value;
532
534
  }
533
- depth(tokens3[idx]);
534
- state.maxDepth += tokens3[idx].depth;
535
+ depth(tokens[idx]);
536
+ state.maxDepth += tokens[idx].depth;
535
537
  }
536
538
  if (idx !== 0 || value !== "") {
537
539
  parts.push(value);
@@ -542,9 +544,9 @@ var require_scan = __commonJS((exports, module) => {
542
544
  const value = input.slice(prevIndex + 1);
543
545
  parts.push(value);
544
546
  if (opts.tokens) {
545
- tokens3[tokens3.length - 1].value = value;
546
- depth(tokens3[tokens3.length - 1]);
547
- state.maxDepth += tokens3[tokens3.length - 1].depth;
547
+ tokens[tokens.length - 1].value = value;
548
+ depth(tokens[tokens.length - 1]);
549
+ state.maxDepth += tokens[tokens.length - 1].depth;
548
550
  }
549
551
  }
550
552
  state.slashes = slashes;
@@ -556,7 +558,7 @@ var require_scan = __commonJS((exports, module) => {
556
558
  });
557
559
 
558
560
  // node_modules/picomatch/lib/parse.js
559
- var require_parse = __commonJS((exports, module) => {
561
+ var require_parse = __commonJS(function(exports, module) {
560
562
  var constants = require_constants();
561
563
  var utils = require_utils();
562
564
  var {
@@ -739,7 +741,7 @@ var require_parse = __commonJS((exports, module) => {
739
741
  if (!match || match.type !== "*") {
740
742
  return;
741
743
  }
742
- const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
744
+ const branches = splitTopLevel(match.body).map((branch) => branch.trim());
743
745
  if (branches.length !== 1) {
744
746
  return;
745
747
  }
@@ -801,7 +803,7 @@ var require_parse = __commonJS((exports, module) => {
801
803
  throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
802
804
  }
803
805
  const bos = { type: "bos", value: "", output: opts.prepend || "" };
804
- const tokens3 = [bos];
806
+ const tokens = [bos];
805
807
  const capture = opts.capture ? "" : "?:";
806
808
  const PLATFORM_CHARS = constants.globChars(opts.windows);
807
809
  const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
@@ -819,8 +821,8 @@ var require_parse = __commonJS((exports, module) => {
819
821
  STAR,
820
822
  START_ANCHOR
821
823
  } = PLATFORM_CHARS;
822
- const globstar = (opts2) => {
823
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
824
+ const globstar = (opts) => {
825
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
824
826
  };
825
827
  const nodot = opts.dot ? "" : NO_DOT;
826
828
  const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
@@ -846,7 +848,7 @@ var require_parse = __commonJS((exports, module) => {
846
848
  parens: 0,
847
849
  quotes: 0,
848
850
  globstar: false,
849
- tokens: tokens3
851
+ tokens
850
852
  };
851
853
  input = utils.removePrefix(input, state);
852
854
  len = input.length;
@@ -859,8 +861,8 @@ var require_parse = __commonJS((exports, module) => {
859
861
  const peek = state.peek = (n = 1) => input[state.index + n];
860
862
  const advance = state.advance = () => input[++state.index] || "";
861
863
  const remaining = () => input.slice(state.index + 1);
862
- const consume = (value2 = "", num = 0) => {
863
- state.consumed += value2;
864
+ const consume = (value = "", num = 0) => {
865
+ state.consumed += value;
864
866
  state.index += num;
865
867
  };
866
868
  const append = (token) => {
@@ -912,19 +914,19 @@ var require_parse = __commonJS((exports, module) => {
912
914
  return;
913
915
  }
914
916
  tok.prev = prev;
915
- tokens3.push(tok);
917
+ tokens.push(tok);
916
918
  prev = tok;
917
919
  };
918
- const extglobOpen = (type, value2) => {
919
- const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
920
+ const extglobOpen = (type, value) => {
921
+ const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: "" };
920
922
  token.prev = prev;
921
923
  token.parens = state.parens;
922
924
  token.output = state.output;
923
925
  token.startIndex = state.index;
924
- token.tokensIndex = tokens3.length;
926
+ token.tokensIndex = tokens.length;
925
927
  const output = (opts.capture ? "(" : "") + token.open;
926
928
  increment("parens");
927
- push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
929
+ push({ type, value, output: state.output ? "" : ONE_CHAR });
928
930
  push({ type: "paren", extglob: true, value: advance(), output });
929
931
  extglobs.push(token);
930
932
  };
@@ -934,14 +936,14 @@ var require_parse = __commonJS((exports, module) => {
934
936
  const analysis = analyzeRepeatedExtglob(body, opts);
935
937
  if ((token.type === "plus" || token.type === "star") && analysis.risky) {
936
938
  const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : undefined;
937
- const open = tokens3[token.tokensIndex];
939
+ const open = tokens[token.tokensIndex];
938
940
  open.type = "text";
939
941
  open.value = literal;
940
942
  open.output = safeOutput || utils.escapeRegex(literal);
941
- for (let i = token.tokensIndex + 1;i < tokens3.length; i++) {
942
- tokens3[i].value = "";
943
- tokens3[i].output = "";
944
- delete tokens3[i].suffix;
943
+ for (let i = token.tokensIndex + 1;i < tokens.length; i++) {
944
+ tokens[i].value = "";
945
+ tokens[i].output = "";
946
+ delete tokens[i].suffix;
945
947
  }
946
948
  state.output = token.output + open.output;
947
949
  state.backtrack = true;
@@ -1058,13 +1060,13 @@ var require_parse = __commonJS((exports, module) => {
1058
1060
  if (inner.includes(":")) {
1059
1061
  const idx = prev.value.lastIndexOf("[");
1060
1062
  const pre = prev.value.slice(0, idx);
1061
- const rest2 = prev.value.slice(idx + 2);
1062
- const posix = POSIX_REGEX_SOURCE[rest2];
1063
+ const rest = prev.value.slice(idx + 2);
1064
+ const posix = POSIX_REGEX_SOURCE[rest];
1063
1065
  if (posix) {
1064
1066
  prev.value = pre + posix;
1065
1067
  state.backtrack = true;
1066
1068
  advance();
1067
- if (!bos.output && tokens3.indexOf(prev) === 1) {
1069
+ if (!bos.output && tokens.indexOf(prev) === 1) {
1068
1070
  bos.output = ONE_CHAR;
1069
1071
  }
1070
1072
  continue;
@@ -1182,10 +1184,10 @@ var require_parse = __commonJS((exports, module) => {
1182
1184
  }
1183
1185
  let output = ")";
1184
1186
  if (brace.dots === true) {
1185
- const arr = tokens3.slice();
1187
+ const arr = tokens.slice();
1186
1188
  const range = [];
1187
1189
  for (let i = arr.length - 1;i >= 0; i--) {
1188
- tokens3.pop();
1190
+ tokens.pop();
1189
1191
  if (arr[i].type === "brace") {
1190
1192
  break;
1191
1193
  }
@@ -1233,7 +1235,7 @@ var require_parse = __commonJS((exports, module) => {
1233
1235
  state.start = state.index + 1;
1234
1236
  state.consumed = "";
1235
1237
  state.output = "";
1236
- tokens3.pop();
1238
+ tokens.pop();
1237
1239
  prev = bos;
1238
1240
  continue;
1239
1241
  }
@@ -1513,10 +1515,10 @@ var require_parse = __commonJS((exports, module) => {
1513
1515
  if (opts.capture) {
1514
1516
  star = `(${star})`;
1515
1517
  }
1516
- const globstar = (opts2) => {
1517
- if (opts2.noglobstar === true)
1518
+ const globstar = (opts) => {
1519
+ if (opts.noglobstar === true)
1518
1520
  return star;
1519
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1521
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1520
1522
  };
1521
1523
  const create = (str) => {
1522
1524
  switch (str) {
@@ -1540,10 +1542,10 @@ var require_parse = __commonJS((exports, module) => {
1540
1542
  const match = /^(.*?)\.(\w+)$/.exec(str);
1541
1543
  if (!match)
1542
1544
  return;
1543
- const source2 = create(match[1]);
1544
- if (!source2)
1545
+ const source = create(match[1]);
1546
+ if (!source)
1545
1547
  return;
1546
- return source2 + DOT_LITERAL + match[2];
1548
+ return source + DOT_LITERAL + match[2];
1547
1549
  }
1548
1550
  }
1549
1551
  };
@@ -1558,7 +1560,7 @@ var require_parse = __commonJS((exports, module) => {
1558
1560
  });
1559
1561
 
1560
1562
  // node_modules/picomatch/lib/picomatch.js
1561
- var require_picomatch = __commonJS((exports, module) => {
1563
+ var require_picomatch = __commonJS(function(exports, module) {
1562
1564
  var scan = require_scan();
1563
1565
  var parse = require_parse();
1564
1566
  var utils = require_utils();
@@ -1569,9 +1571,9 @@ var require_picomatch = __commonJS((exports, module) => {
1569
1571
  const fns = glob.map((input) => picomatch(input, options, returnState));
1570
1572
  const arrayMatcher = (str) => {
1571
1573
  for (const isMatch of fns) {
1572
- const state2 = isMatch(str);
1573
- if (state2)
1574
- return state2;
1574
+ const state = isMatch(str);
1575
+ if (state)
1576
+ return state;
1575
1577
  }
1576
1578
  return false;
1577
1579
  };
@@ -1698,7 +1700,7 @@ var require_picomatch = __commonJS((exports, module) => {
1698
1700
  });
1699
1701
 
1700
1702
  // node_modules/picomatch/index.js
1701
- var require_picomatch2 = __commonJS((exports, module) => {
1703
+ var require_picomatch2 = __commonJS(function(exports, module) {
1702
1704
  var pico = require_picomatch();
1703
1705
  var utils = require_utils();
1704
1706
  function picomatch(glob, options, returnState = false) {
@@ -1712,7 +1714,7 @@ var require_picomatch2 = __commonJS((exports, module) => {
1712
1714
  });
1713
1715
 
1714
1716
  // node_modules/ws/lib/constants.js
1715
- var require_constants2 = __commonJS((exports, module) => {
1717
+ var require_constants2 = __commonJS(function(exports, module) {
1716
1718
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
1717
1719
  var hasBlob = typeof Blob !== "undefined";
1718
1720
  if (hasBlob)
@@ -1732,7 +1734,7 @@ var require_constants2 = __commonJS((exports, module) => {
1732
1734
  });
1733
1735
 
1734
1736
  // node_modules/ws/lib/buffer-util.js
1735
- var require_buffer_util = __commonJS((exports, module) => {
1737
+ var require_buffer_util = __commonJS(function(exports, module) {
1736
1738
  var { EMPTY_BUFFER } = require_constants2();
1737
1739
  var FastBuffer = Buffer[Symbol.species];
1738
1740
  function concat(list, totalLength) {
@@ -1740,17 +1742,17 @@ var require_buffer_util = __commonJS((exports, module) => {
1740
1742
  return EMPTY_BUFFER;
1741
1743
  if (list.length === 1)
1742
1744
  return list[0];
1743
- const target2 = Buffer.allocUnsafe(totalLength);
1745
+ const target = Buffer.allocUnsafe(totalLength);
1744
1746
  let offset = 0;
1745
1747
  for (let i = 0;i < list.length; i++) {
1746
1748
  const buf = list[i];
1747
- target2.set(buf, offset);
1749
+ target.set(buf, offset);
1748
1750
  offset += buf.length;
1749
1751
  }
1750
1752
  if (offset < totalLength) {
1751
- return new FastBuffer(target2.buffer, target2.byteOffset, offset);
1753
+ return new FastBuffer(target.buffer, target.byteOffset, offset);
1752
1754
  }
1753
- return target2;
1755
+ return target;
1754
1756
  }
1755
1757
  function _mask(source, mask, output, offset, length) {
1756
1758
  for (let i = 0;i < length; i++) {
@@ -1793,11 +1795,11 @@ var require_buffer_util = __commonJS((exports, module) => {
1793
1795
  if (!process.env.WS_NO_BUFFER_UTIL) {
1794
1796
  try {
1795
1797
  const bufferUtil = (()=>{throw new Error("Cannot require module "+"bufferutil");})();
1796
- module.exports.mask = function(source, mask, output, offset, length) {
1798
+ module.exports.mask = function(source, mask2, output, offset, length) {
1797
1799
  if (length < 48)
1798
- _mask(source, mask, output, offset, length);
1800
+ _mask(source, mask2, output, offset, length);
1799
1801
  else
1800
- bufferUtil.mask(source, mask, output, offset, length);
1802
+ bufferUtil.mask(source, mask2, output, offset, length);
1801
1803
  };
1802
1804
  module.exports.unmask = function(buffer, mask) {
1803
1805
  if (buffer.length < 32)
@@ -1810,7 +1812,7 @@ var require_buffer_util = __commonJS((exports, module) => {
1810
1812
  });
1811
1813
 
1812
1814
  // node_modules/ws/lib/limiter.js
1813
- var require_limiter = __commonJS((exports, module) => {
1815
+ var require_limiter = __commonJS(function(exports, module) {
1814
1816
  var kDone = Symbol("kDone");
1815
1817
  var kRun = Symbol("kRun");
1816
1818
 
@@ -1842,7 +1844,7 @@ var require_limiter = __commonJS((exports, module) => {
1842
1844
  });
1843
1845
 
1844
1846
  // node_modules/ws/lib/permessage-deflate.js
1845
- var require_permessage_deflate = __commonJS((exports, module) => {
1847
+ var require_permessage_deflate = __commonJS(function(exports, module) {
1846
1848
  var zlib = __require("zlib");
1847
1849
  var bufferUtil = require_buffer_util();
1848
1850
  var Limiter = require_limiter();
@@ -1902,11 +1904,11 @@ var require_permessage_deflate = __commonJS((exports, module) => {
1902
1904
  this._inflate = null;
1903
1905
  }
1904
1906
  if (this._deflate) {
1905
- const callback2 = this._deflate[kCallback];
1907
+ const callback = this._deflate[kCallback];
1906
1908
  this._deflate.close();
1907
1909
  this._deflate = null;
1908
- if (callback2) {
1909
- callback2(new Error("The deflate stream was closed while data was being processed"));
1910
+ if (callback) {
1911
+ callback(new Error("The deflate stream was closed while data was being processed"));
1910
1912
  }
1911
1913
  }
1912
1914
  }
@@ -1987,23 +1989,23 @@ var require_permessage_deflate = __commonJS((exports, module) => {
1987
1989
  });
1988
1990
  return configurations;
1989
1991
  }
1990
- decompress(data, fin, callback2) {
1992
+ decompress(data, fin, callback) {
1991
1993
  zlibLimiter.add((done) => {
1992
1994
  this._decompress(data, fin, (err, result) => {
1993
1995
  done();
1994
- callback2(err, result);
1996
+ callback(err, result);
1995
1997
  });
1996
1998
  });
1997
1999
  }
1998
- compress(data, fin, callback2) {
2000
+ compress(data, fin, callback) {
1999
2001
  zlibLimiter.add((done) => {
2000
2002
  this._compress(data, fin, (err, result) => {
2001
2003
  done();
2002
- callback2(err, result);
2004
+ callback(err, result);
2003
2005
  });
2004
2006
  });
2005
2007
  }
2006
- _decompress(data, fin, callback2) {
2008
+ _decompress(data, fin, callback) {
2007
2009
  const endpoint = this._isServer ? "client" : "server";
2008
2010
  if (!this._inflate) {
2009
2011
  const key = `${endpoint}_max_window_bits`;
@@ -2018,7 +2020,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
2018
2020
  this._inflate.on("error", inflateOnError);
2019
2021
  this._inflate.on("data", inflateOnData);
2020
2022
  }
2021
- this._inflate[kCallback] = callback2;
2023
+ this._inflate[kCallback] = callback;
2022
2024
  this._inflate.write(data);
2023
2025
  if (fin)
2024
2026
  this._inflate.write(TRAILER);
@@ -2027,10 +2029,10 @@ var require_permessage_deflate = __commonJS((exports, module) => {
2027
2029
  if (err) {
2028
2030
  this._inflate.close();
2029
2031
  this._inflate = null;
2030
- callback2(err);
2032
+ callback(err);
2031
2033
  return;
2032
2034
  }
2033
- const data2 = bufferUtil.concat(this._inflate[kBuffers], this._inflate[kTotalLength]);
2035
+ const data = bufferUtil.concat(this._inflate[kBuffers], this._inflate[kTotalLength]);
2034
2036
  if (this._inflate._readableState.endEmitted) {
2035
2037
  this._inflate.close();
2036
2038
  this._inflate = null;
@@ -2041,10 +2043,10 @@ var require_permessage_deflate = __commonJS((exports, module) => {
2041
2043
  this._inflate.reset();
2042
2044
  }
2043
2045
  }
2044
- callback2(null, data2);
2046
+ callback(null, data);
2045
2047
  });
2046
2048
  }
2047
- _compress(data, fin, callback2) {
2049
+ _compress(data, fin, callback) {
2048
2050
  const endpoint = this._isServer ? "server" : "client";
2049
2051
  if (!this._deflate) {
2050
2052
  const key = `${endpoint}_max_window_bits`;
@@ -2057,15 +2059,15 @@ var require_permessage_deflate = __commonJS((exports, module) => {
2057
2059
  this._deflate[kBuffers] = [];
2058
2060
  this._deflate.on("data", deflateOnData);
2059
2061
  }
2060
- this._deflate[kCallback] = callback2;
2062
+ this._deflate[kCallback] = callback;
2061
2063
  this._deflate.write(data);
2062
2064
  this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
2063
2065
  if (!this._deflate) {
2064
2066
  return;
2065
2067
  }
2066
- let data2 = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
2068
+ let data = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
2067
2069
  if (fin) {
2068
- data2 = new FastBuffer(data2.buffer, data2.byteOffset, data2.length - 4);
2070
+ data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4);
2069
2071
  }
2070
2072
  this._deflate[kCallback] = null;
2071
2073
  this._deflate[kTotalLength] = 0;
@@ -2073,7 +2075,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
2073
2075
  if (fin && this.params[`${endpoint}_no_context_takeover`]) {
2074
2076
  this._deflate.reset();
2075
2077
  }
2076
- callback2(null, data2);
2078
+ callback(null, data);
2077
2079
  });
2078
2080
  }
2079
2081
  }
@@ -2106,7 +2108,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
2106
2108
  });
2107
2109
 
2108
2110
  // node_modules/ws/lib/validation.js
2109
- var require_validation = __commonJS((exports, module) => {
2111
+ var require_validation = __commonJS(function(exports, module) {
2110
2112
  var { isUtf8 } = __require("buffer");
2111
2113
  var { hasBlob } = require_constants2();
2112
2114
  var tokenChars = [
@@ -2293,7 +2295,7 @@ var require_validation = __commonJS((exports, module) => {
2293
2295
  });
2294
2296
 
2295
2297
  // node_modules/ws/lib/receiver.js
2296
- var require_receiver = __commonJS((exports, module) => {
2298
+ var require_receiver = __commonJS(function(exports, module) {
2297
2299
  var { Writable } = __require("stream");
2298
2300
  var PerMessageDeflate = require_permessage_deflate();
2299
2301
  var {
@@ -2690,7 +2692,7 @@ var require_receiver = __commonJS((exports, module) => {
2690
2692
  });
2691
2693
 
2692
2694
  // node_modules/ws/lib/sender.js
2693
- var require_sender = __commonJS((exports, module) => {
2695
+ var require_sender = __commonJS(function(exports, module) {
2694
2696
  var { Duplex } = __require("stream");
2695
2697
  var { randomFillSync } = __require("crypto");
2696
2698
  var {
@@ -2770,32 +2772,32 @@ var require_sender = __commonJS((exports, module) => {
2770
2772
  offset += 2;
2771
2773
  payloadLength = 126;
2772
2774
  }
2773
- const target2 = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
2774
- target2[0] = options.fin ? options.opcode | 128 : options.opcode;
2775
+ const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
2776
+ target[0] = options.fin ? options.opcode | 128 : options.opcode;
2775
2777
  if (options.rsv1)
2776
- target2[0] |= 64;
2777
- target2[1] = payloadLength;
2778
+ target[0] |= 64;
2779
+ target[1] = payloadLength;
2778
2780
  if (payloadLength === 126) {
2779
- target2.writeUInt16BE(dataLength, 2);
2781
+ target.writeUInt16BE(dataLength, 2);
2780
2782
  } else if (payloadLength === 127) {
2781
- target2[2] = target2[3] = 0;
2782
- target2.writeUIntBE(dataLength, 4, 6);
2783
+ target[2] = target[3] = 0;
2784
+ target.writeUIntBE(dataLength, 4, 6);
2783
2785
  }
2784
2786
  if (!options.mask)
2785
- return [target2, data];
2786
- target2[1] |= 128;
2787
- target2[offset - 4] = mask[0];
2788
- target2[offset - 3] = mask[1];
2789
- target2[offset - 2] = mask[2];
2790
- target2[offset - 1] = mask[3];
2787
+ return [target, data];
2788
+ target[1] |= 128;
2789
+ target[offset - 4] = mask[0];
2790
+ target[offset - 3] = mask[1];
2791
+ target[offset - 2] = mask[2];
2792
+ target[offset - 1] = mask[3];
2791
2793
  if (skipMasking)
2792
- return [target2, data];
2794
+ return [target, data];
2793
2795
  if (merge) {
2794
- applyMask(data, mask, target2, offset, dataLength);
2795
- return [target2];
2796
+ applyMask(data, mask, target, offset, dataLength);
2797
+ return [target];
2796
2798
  }
2797
2799
  applyMask(data, mask, data, 0, dataLength);
2798
- return [target2, data];
2800
+ return [target, data];
2799
2801
  }
2800
2802
  close(code, data, mask, cb) {
2801
2803
  let buf;
@@ -3037,9 +3039,9 @@ var require_sender = __commonJS((exports, module) => {
3037
3039
  cb(err);
3038
3040
  for (let i = 0;i < sender._queue.length; i++) {
3039
3041
  const params = sender._queue[i];
3040
- const callback2 = params[params.length - 1];
3041
- if (typeof callback2 === "function")
3042
- callback2(err);
3042
+ const callback = params[params.length - 1];
3043
+ if (typeof callback === "function")
3044
+ callback(err);
3043
3045
  }
3044
3046
  }
3045
3047
  function onError(sender, err, cb) {
@@ -3049,7 +3051,7 @@ var require_sender = __commonJS((exports, module) => {
3049
3051
  });
3050
3052
 
3051
3053
  // node_modules/ws/lib/event-target.js
3052
- var require_event_target = __commonJS((exports, module) => {
3054
+ var require_event_target = __commonJS(function(exports, module) {
3053
3055
  var { kForOnEventAttribute, kListener } = require_constants2();
3054
3056
  var kCode = Symbol("kCode");
3055
3057
  var kData = Symbol("kData");
@@ -3200,7 +3202,7 @@ var require_event_target = __commonJS((exports, module) => {
3200
3202
  });
3201
3203
 
3202
3204
  // node_modules/ws/lib/extension.js
3203
- var require_extension = __commonJS((exports, module) => {
3205
+ var require_extension = __commonJS(function(exports, module) {
3204
3206
  var { tokenChars } = require_validation();
3205
3207
  function push(dest, name, elem) {
3206
3208
  if (dest[name] === undefined)
@@ -3365,7 +3367,7 @@ var require_extension = __commonJS((exports, module) => {
3365
3367
  });
3366
3368
 
3367
3369
  // node_modules/ws/lib/websocket.js
3368
- var require_websocket = __commonJS((exports, module) => {
3370
+ var require_websocket = __commonJS(function(exports, module) {
3369
3371
  var EventEmitter = __require("events");
3370
3372
  var https = __require("https");
3371
3373
  var http = __require("http");
@@ -3788,7 +3790,7 @@ var require_websocket = __commonJS((exports, module) => {
3788
3790
  }
3789
3791
  const defaultPort = isSecure ? 443 : 80;
3790
3792
  const key = randomBytes(16).toString("base64");
3791
- const request = isSecure ? https.request : http.request;
3793
+ const request3 = isSecure ? https.request : http.request;
3792
3794
  const protocolSet = new Set;
3793
3795
  let perMessageDeflate;
3794
3796
  opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
@@ -3847,8 +3849,8 @@ var require_websocket = __commonJS((exports, module) => {
3847
3849
  const headers = options && options.headers;
3848
3850
  options = { ...options, headers: {} };
3849
3851
  if (headers) {
3850
- for (const [key2, value] of Object.entries(headers)) {
3851
- options.headers[key2.toLowerCase()] = value;
3852
+ for (const [key, value] of Object.entries(headers)) {
3853
+ options.headers[key.toLowerCase()] = value;
3852
3854
  }
3853
3855
  }
3854
3856
  } else if (websocket.listenerCount("redirect") === 0) {
@@ -3864,12 +3866,12 @@ var require_websocket = __commonJS((exports, module) => {
3864
3866
  if (opts.auth && !options.headers.authorization) {
3865
3867
  options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
3866
3868
  }
3867
- req = websocket._req = request(opts);
3869
+ req = websocket._req = request3(opts);
3868
3870
  if (websocket._redirects) {
3869
3871
  websocket.emit("redirect", websocket.url, req);
3870
3872
  }
3871
3873
  } else {
3872
- req = websocket._req = request(opts);
3874
+ req = websocket._req = request3(opts);
3873
3875
  }
3874
3876
  if (opts.timeout) {
3875
3877
  req.on("timeout", () => {
@@ -4137,7 +4139,7 @@ var require_websocket = __commonJS((exports, module) => {
4137
4139
  });
4138
4140
 
4139
4141
  // node_modules/ws/lib/stream.js
4140
- var require_stream = __commonJS((exports, module) => {
4142
+ var require_stream = __commonJS(function(exports, module) {
4141
4143
  var WebSocket = require_websocket();
4142
4144
  var { Duplex } = __require("stream");
4143
4145
  function emitClose(stream) {
@@ -4180,41 +4182,41 @@ var require_stream = __commonJS((exports, module) => {
4180
4182
  return;
4181
4183
  duplex.push(null);
4182
4184
  });
4183
- duplex._destroy = function(err, callback2) {
4185
+ duplex._destroy = function(err, callback) {
4184
4186
  if (ws.readyState === ws.CLOSED) {
4185
- callback2(err);
4187
+ callback(err);
4186
4188
  process.nextTick(emitClose, duplex);
4187
4189
  return;
4188
4190
  }
4189
4191
  let called = false;
4190
- ws.once("error", function error(err2) {
4192
+ ws.once("error", function error(err) {
4191
4193
  called = true;
4192
- callback2(err2);
4194
+ callback(err);
4193
4195
  });
4194
4196
  ws.once("close", function close() {
4195
4197
  if (!called)
4196
- callback2(err);
4198
+ callback(err);
4197
4199
  process.nextTick(emitClose, duplex);
4198
4200
  });
4199
4201
  if (terminateOnDestroy)
4200
4202
  ws.terminate();
4201
4203
  };
4202
- duplex._final = function(callback2) {
4204
+ duplex._final = function(callback) {
4203
4205
  if (ws.readyState === ws.CONNECTING) {
4204
4206
  ws.once("open", function open() {
4205
- duplex._final(callback2);
4207
+ duplex._final(callback);
4206
4208
  });
4207
4209
  return;
4208
4210
  }
4209
4211
  if (ws._socket === null)
4210
4212
  return;
4211
4213
  if (ws._socket._writableState.finished) {
4212
- callback2();
4214
+ callback();
4213
4215
  if (duplex._readableState.endEmitted)
4214
4216
  duplex.destroy();
4215
4217
  } else {
4216
4218
  ws._socket.once("finish", function finish() {
4217
- callback2();
4219
+ callback();
4218
4220
  });
4219
4221
  ws.close();
4220
4222
  }
@@ -4223,14 +4225,14 @@ var require_stream = __commonJS((exports, module) => {
4223
4225
  if (ws.isPaused)
4224
4226
  ws.resume();
4225
4227
  };
4226
- duplex._write = function(chunk, encoding, callback2) {
4228
+ duplex._write = function(chunk, encoding, callback) {
4227
4229
  if (ws.readyState === ws.CONNECTING) {
4228
4230
  ws.once("open", function open() {
4229
- duplex._write(chunk, encoding, callback2);
4231
+ duplex._write(chunk, encoding, callback);
4230
4232
  });
4231
4233
  return;
4232
4234
  }
4233
- ws.send(chunk, callback2);
4235
+ ws.send(chunk, callback);
4234
4236
  };
4235
4237
  duplex.on("end", duplexOnEnd);
4236
4238
  duplex.on("error", duplexOnError);
@@ -4240,7 +4242,7 @@ var require_stream = __commonJS((exports, module) => {
4240
4242
  });
4241
4243
 
4242
4244
  // node_modules/ws/lib/subprotocol.js
4243
- var require_subprotocol = __commonJS((exports, module) => {
4245
+ var require_subprotocol = __commonJS(function(exports, module) {
4244
4246
  var { tokenChars } = require_validation();
4245
4247
  function parse(header) {
4246
4248
  const protocols = new Set;
@@ -4261,11 +4263,11 @@ var require_subprotocol = __commonJS((exports, module) => {
4261
4263
  }
4262
4264
  if (end === -1)
4263
4265
  end = i;
4264
- const protocol2 = header.slice(start, end);
4265
- if (protocols.has(protocol2)) {
4266
- throw new SyntaxError(`The "${protocol2}" subprotocol is duplicated`);
4266
+ const protocol = header.slice(start, end);
4267
+ if (protocols.has(protocol)) {
4268
+ throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
4267
4269
  }
4268
- protocols.add(protocol2);
4270
+ protocols.add(protocol);
4269
4271
  start = end = -1;
4270
4272
  } else {
4271
4273
  throw new SyntaxError(`Unexpected character at index ${i}`);
@@ -4285,7 +4287,7 @@ var require_subprotocol = __commonJS((exports, module) => {
4285
4287
  });
4286
4288
 
4287
4289
  // node_modules/ws/lib/websocket-server.js
4288
- var require_websocket_server = __commonJS((exports, module) => {
4290
+ var require_websocket_server = __commonJS(function(exports, module) {
4289
4291
  var EventEmitter = __require("events");
4290
4292
  var http = __require("http");
4291
4293
  var { Duplex } = __require("stream");
@@ -4301,7 +4303,7 @@ var require_websocket_server = __commonJS((exports, module) => {
4301
4303
  var CLOSED = 2;
4302
4304
 
4303
4305
  class WebSocketServer extends EventEmitter {
4304
- constructor(options, callback2) {
4306
+ constructor(options, callback) {
4305
4307
  super();
4306
4308
  options = {
4307
4309
  allowSynchronousEvents: true,
@@ -4336,7 +4338,7 @@ var require_websocket_server = __commonJS((exports, module) => {
4336
4338
  });
4337
4339
  res.end(body);
4338
4340
  });
4339
- this._server.listen(options.port, options.host, options.backlog, callback2);
4341
+ this._server.listen(options.port, options.host, options.backlog, callback);
4340
4342
  } else if (options.server) {
4341
4343
  this._server = options.server;
4342
4344
  }
@@ -4613,11 +4615,11 @@ function tokens(...tokensList) {
4613
4615
  }
4614
4616
  // node_modules/@stryker-mutator/api/dist/src/plugin/plugin-kind.js
4615
4617
  var PluginKind;
4616
- (function(PluginKind2) {
4617
- PluginKind2["Checker"] = "Checker";
4618
- PluginKind2["TestRunner"] = "TestRunner";
4619
- PluginKind2["Reporter"] = "Reporter";
4620
- PluginKind2["Ignore"] = "Ignore";
4618
+ (function(PluginKind) {
4619
+ PluginKind["Checker"] = "Checker";
4620
+ PluginKind["TestRunner"] = "TestRunner";
4621
+ PluginKind["Reporter"] = "Reporter";
4622
+ PluginKind["Ignore"] = "Ignore";
4621
4623
  })(PluginKind || (PluginKind = {}));
4622
4624
 
4623
4625
  // node_modules/@stryker-mutator/api/dist/src/plugin/plugins.js
@@ -4630,9 +4632,9 @@ function declareClassPlugin(kind, name, injectableClass) {
4630
4632
  }
4631
4633
  // node_modules/@stryker-mutator/api/dist/src/plugin/scope.js
4632
4634
  var Scope;
4633
- (function(Scope2) {
4634
- Scope2["Transient"] = "transient";
4635
- Scope2["Singleton"] = "singleton";
4635
+ (function(Scope) {
4636
+ Scope["Transient"] = "transient";
4637
+ Scope["Singleton"] = "singleton";
4636
4638
  })(Scope || (Scope = {}));
4637
4639
  // src/bun-test-runner.ts
4638
4640
  import { createHash } from "node:crypto";
@@ -4641,25 +4643,25 @@ import { tmpdir } from "node:os";
4641
4643
  import path4 from "node:path";
4642
4644
  // node_modules/@stryker-mutator/api/dist/src/test-runner/test-status.js
4643
4645
  var TestStatus;
4644
- (function(TestStatus2) {
4645
- TestStatus2[TestStatus2["Success"] = 0] = "Success";
4646
- TestStatus2[TestStatus2["Failed"] = 1] = "Failed";
4647
- TestStatus2[TestStatus2["Skipped"] = 2] = "Skipped";
4646
+ (function(TestStatus) {
4647
+ TestStatus[TestStatus["Success"] = 0] = "Success";
4648
+ TestStatus[TestStatus["Failed"] = 1] = "Failed";
4649
+ TestStatus[TestStatus["Skipped"] = 2] = "Skipped";
4648
4650
  })(TestStatus || (TestStatus = {}));
4649
4651
  // node_modules/@stryker-mutator/api/dist/src/test-runner/mutant-run-result.js
4650
4652
  var MutantRunStatus;
4651
- (function(MutantRunStatus2) {
4652
- MutantRunStatus2["Killed"] = "killed";
4653
- MutantRunStatus2["Survived"] = "survived";
4654
- MutantRunStatus2["Timeout"] = "timeout";
4655
- MutantRunStatus2["Error"] = "error";
4653
+ (function(MutantRunStatus) {
4654
+ MutantRunStatus["Killed"] = "killed";
4655
+ MutantRunStatus["Survived"] = "survived";
4656
+ MutantRunStatus["Timeout"] = "timeout";
4657
+ MutantRunStatus["Error"] = "error";
4656
4658
  })(MutantRunStatus || (MutantRunStatus = {}));
4657
4659
  // node_modules/@stryker-mutator/api/dist/src/test-runner/dry-run-status.js
4658
4660
  var DryRunStatus;
4659
- (function(DryRunStatus2) {
4660
- DryRunStatus2["Complete"] = "complete";
4661
- DryRunStatus2["Error"] = "error";
4662
- DryRunStatus2["Timeout"] = "timeout";
4661
+ (function(DryRunStatus) {
4662
+ DryRunStatus["Complete"] = "complete";
4663
+ DryRunStatus["Error"] = "error";
4664
+ DryRunStatus["Timeout"] = "timeout";
4663
4665
  })(DryRunStatus || (DryRunStatus = {}));
4664
4666
  // src/coverage/preload-generator.ts
4665
4667
  import { mkdir, unlink, readFile, writeFile } from "node:fs/promises";
@@ -5488,8 +5490,47 @@ function getCrawler(globInput, inputOptions = {}) {
5488
5490
  return patterns.length > 0 ? buildCrawler(options, patterns) : [];
5489
5491
  }
5490
5492
  async function glob(globInput, options) {
5491
- const [crawler, relative2] = getCrawler(globInput, options);
5492
- return crawler ? formatPaths(await crawler.withPromise(), relative2) : [];
5493
+ const [crawler, relative] = getCrawler(globInput, options);
5494
+ return crawler ? formatPaths(await crawler.withPromise(), relative) : [];
5495
+ }
5496
+
5497
+ // src/utils/test-name-pattern.ts
5498
+ var MAX_TEST_NAME_PATTERN_LENGTH = 1e5;
5499
+ var TEST_FILE_EXT_PATTERN = String.raw`(?:test|spec)\.(?:[jt]sx?|[mc][jt]s)`;
5500
+ var fileExtRe = new RegExp(String.raw`\.${TEST_FILE_EXT_PATTERN}$`);
5501
+ var dedupSuffixRe = / \[\d+\]$/;
5502
+ var metaRe = /[.*+?^${}()|[\]\\/]/g;
5503
+ function escapeRegex(str) {
5504
+ return str.replaceAll(metaRe, String.raw`\$&`);
5505
+ }
5506
+ function buildTestNamePattern(testFilter, testNameIndex) {
5507
+ if (testFilter.length === 0) {
5508
+ return;
5509
+ }
5510
+ const alternatives = new Set;
5511
+ for (const id of testFilter) {
5512
+ const exact = testNameIndex?.get(id);
5513
+ if (exact !== undefined && exact.length > 0 && !exact.includes("\x00")) {
5514
+ alternatives.add(escapeRegex(exact));
5515
+ continue;
5516
+ }
5517
+ const firstSepIdx = id.indexOf(" > ");
5518
+ let name = firstSepIdx !== -1 && fileExtRe.test(id.slice(0, firstSepIdx)) ? id.slice(firstSepIdx + 3) : id;
5519
+ name = name.replace(dedupSuffixRe, "");
5520
+ name = name.replaceAll(" > ", " ");
5521
+ name = escapeRegex(name);
5522
+ if (name.length > 0) {
5523
+ alternatives.add(name);
5524
+ }
5525
+ }
5526
+ if (alternatives.size === 0) {
5527
+ return;
5528
+ }
5529
+ const pattern = `^(?:${[...alternatives].join("|")})$`;
5530
+ if (Buffer.byteLength(pattern) > MAX_TEST_NAME_PATTERN_LENGTH) {
5531
+ return;
5532
+ }
5533
+ return pattern;
5493
5534
  }
5494
5535
 
5495
5536
  // src/coverage/preload-generator.ts
@@ -5517,7 +5558,8 @@ async function resolveEagerModulesFromGlobs(mutateGlobs, cwd = process.cwd()) {
5517
5558
  });
5518
5559
  const sourceFileRe = /\.(?:tsx?|[cm]?js)$/;
5519
5560
  const dtsRe = /\.d\.[cm]?ts$/;
5520
- const filtered = paths.filter((p) => sourceFileRe.test(p) && !dtsRe.test(p));
5561
+ const testFileRe = new RegExp(String.raw`\.${TEST_FILE_EXT_PATTERN}$`);
5562
+ const filtered = paths.filter((p) => sourceFileRe.test(p) && !dtsRe.test(p) && !testFileRe.test(p));
5521
5563
  const resolved = filtered.map((p) => path.resolve(p));
5522
5564
  resolved.sort((a, b) => a.localeCompare(b));
5523
5565
  return resolved;
@@ -5650,7 +5692,7 @@ function sortDuplicateGroupByLineThenDiscovery(group, getLine, getInspectorId, d
5650
5692
  }
5651
5693
 
5652
5694
  // src/utils/test-name.ts
5653
- function normalizeTestFilePath(url) {
5695
+ function normalizeTestFilePath(url, cwd = process.cwd()) {
5654
5696
  if (!url) {
5655
5697
  return;
5656
5698
  }
@@ -5658,6 +5700,9 @@ function normalizeTestFilePath(url) {
5658
5700
  if (sandboxMatch) {
5659
5701
  return sandboxMatch[1];
5660
5702
  }
5703
+ if (url.startsWith(`${cwd}/`)) {
5704
+ return url.slice(cwd.length + 1);
5705
+ }
5661
5706
  return url;
5662
5707
  }
5663
5708
  function normalizeTestName(testName) {
@@ -6023,7 +6068,7 @@ class InspectorClient {
6023
6068
  if (this.ws) {
6024
6069
  throw new Error("Already connected");
6025
6070
  }
6026
- return new Promise((resolve3, reject) => {
6071
+ return new Promise((resolve, reject) => {
6027
6072
  const timeoutTimer = setTimeout(() => {
6028
6073
  if (this.ws) {
6029
6074
  this.ws.close();
@@ -6036,7 +6081,7 @@ class InspectorClient {
6036
6081
  ws.addEventListener("open", () => {
6037
6082
  clearTimeout(timeoutTimer);
6038
6083
  this.lastFrameReceivedAt = Date.now();
6039
- resolve3();
6084
+ resolve();
6040
6085
  });
6041
6086
  ws.addEventListener("error", () => {
6042
6087
  clearTimeout(timeoutTimer);
@@ -6058,7 +6103,7 @@ class InspectorClient {
6058
6103
  }
6059
6104
  const id = ++this.messageId;
6060
6105
  const message = { id, method, params };
6061
- return new Promise((resolve3, reject) => {
6106
+ return new Promise((resolve, reject) => {
6062
6107
  const effectiveTimeoutMs = timeoutMs ?? this.state.requestTimeout;
6063
6108
  const stallTimer = this.handlers.onRequestStall ? setTimeout(() => {
6064
6109
  if (this.pendingRequests.has(id)) {
@@ -6075,7 +6120,7 @@ class InspectorClient {
6075
6120
  }
6076
6121
  reject(new InspectorTimeoutError(`Request timeout after ${effectiveTimeoutMs}ms: ${method}`));
6077
6122
  }, effectiveTimeoutMs);
6078
- this.pendingRequests.set(id, { resolve: resolve3, reject, timer, stallTimer });
6123
+ this.pendingRequests.set(id, { resolve, reject, timer, stallTimer });
6079
6124
  try {
6080
6125
  this.ws.send(JSON.stringify(message));
6081
6126
  } catch (error) {
@@ -6120,7 +6165,7 @@ class InspectorClient {
6120
6165
  if (this.wsClosed || !this.ws) {
6121
6166
  return;
6122
6167
  }
6123
- return new Promise((resolve3) => {
6168
+ return new Promise((resolve) => {
6124
6169
  let settled = false;
6125
6170
  let timer;
6126
6171
  const finish = () => {
@@ -6133,7 +6178,7 @@ class InspectorClient {
6133
6178
  if (idx !== -1) {
6134
6179
  this.closeWaiters.splice(idx, 1);
6135
6180
  }
6136
- resolve3();
6181
+ resolve();
6137
6182
  };
6138
6183
  timer = setTimeout(() => {
6139
6184
  finish();
@@ -6332,45 +6377,6 @@ class InspectorClient {
6332
6377
  }
6333
6378
  }
6334
6379
  }
6335
- // src/utils/test-name-pattern.ts
6336
- var MAX_TEST_NAME_PATTERN_LENGTH = 1e5;
6337
- var TEST_FILE_EXT_PATTERN = String.raw`(?:test|spec)\.(?:[jt]sx?|[mc][jt]s)`;
6338
- var fileExtRe = new RegExp(String.raw`\.${TEST_FILE_EXT_PATTERN}$`);
6339
- var dedupSuffixRe = / \[\d+\]$/;
6340
- var metaRe = /[.*+?^${}()|[\]\\/]/g;
6341
- function escapeRegex(str) {
6342
- return str.replaceAll(metaRe, String.raw`\$&`);
6343
- }
6344
- function buildTestNamePattern(testFilter, testNameIndex) {
6345
- if (testFilter.length === 0) {
6346
- return;
6347
- }
6348
- const alternatives = new Set;
6349
- for (const id of testFilter) {
6350
- const exact = testNameIndex?.get(id);
6351
- if (exact !== undefined && exact.length > 0 && !exact.includes("\x00")) {
6352
- alternatives.add(escapeRegex(exact));
6353
- continue;
6354
- }
6355
- const firstSepIdx = id.indexOf(" > ");
6356
- let name = firstSepIdx !== -1 && fileExtRe.test(id.slice(0, firstSepIdx)) ? id.slice(firstSepIdx + 3) : id;
6357
- name = name.replace(dedupSuffixRe, "");
6358
- name = name.replaceAll(" > ", " ");
6359
- name = escapeRegex(name);
6360
- if (name.length > 0) {
6361
- alternatives.add(name);
6362
- }
6363
- }
6364
- if (alternatives.size === 0) {
6365
- return;
6366
- }
6367
- const pattern = `^(?:${[...alternatives].join("|")})$`;
6368
- if (Buffer.byteLength(pattern) > MAX_TEST_NAME_PATTERN_LENGTH) {
6369
- return;
6370
- }
6371
- return pattern;
6372
- }
6373
-
6374
6380
  // src/parsers/console-parser.ts
6375
6381
  var fileHeaderRe = new RegExp(String.raw`^(?:::group::)?([^:]+\.${TEST_FILE_EXT_PATTERN}):$`);
6376
6382
  var workflowCommandRe = /^::(?:group|endgroup|error|warning|notice|debug|add-mask|add-matcher|remove-matcher)(?:::|\s|$)/;
@@ -6541,6 +6547,16 @@ ${stderr}`;
6541
6547
  // src/process-runner.ts
6542
6548
  import { spawn as spawn2 } from "node:child_process";
6543
6549
 
6550
+ // src/utils/process-group.ts
6551
+ function killProcessGroup(pid, signal) {
6552
+ try {
6553
+ process.kill(-pid, signal);
6554
+ return true;
6555
+ } catch {
6556
+ return false;
6557
+ }
6558
+ }
6559
+
6544
6560
  // src/utils/process-rss.ts
6545
6561
  import { spawn } from "node:child_process";
6546
6562
  import { readFile as readFile3 } from "node:fs/promises";
@@ -6568,12 +6584,12 @@ function parsePsRssOutput(output) {
6568
6584
  return Number.isFinite(kb) ? kb * 1024 : null;
6569
6585
  }
6570
6586
  async function getPsRss(pid) {
6571
- return new Promise((resolve3) => {
6587
+ return new Promise((resolve) => {
6572
6588
  let child;
6573
6589
  try {
6574
6590
  child = spawn("ps", ["-o", "rss=", "-p", String(pid)], { stdio: ["ignore", "pipe", "ignore"] });
6575
6591
  } catch {
6576
- resolve3(null);
6592
+ resolve(null);
6577
6593
  return;
6578
6594
  }
6579
6595
  let output = "";
@@ -6581,16 +6597,25 @@ async function getPsRss(pid) {
6581
6597
  output += data.toString();
6582
6598
  });
6583
6599
  child.on("close", (code) => {
6584
- resolve3(code === 0 ? parsePsRssOutput(output) : null);
6600
+ resolve(code === 0 ? parsePsRssOutput(output) : null);
6585
6601
  });
6586
6602
  child.on("error", () => {
6587
- resolve3(null);
6603
+ resolve(null);
6588
6604
  });
6589
6605
  });
6590
6606
  }
6591
6607
 
6592
6608
  // src/process-runner.ts
6593
6609
  var KILL_GRACE_PERIOD_MS = 500;
6610
+ var SPAWN_DEPTH_ENV = "__STRYKER_BUN_RUNNER_DEPTH__";
6611
+ var DEFAULT_MAX_SPAWN_DEPTH = 1;
6612
+ function stripAnsi(text) {
6613
+ return text.replaceAll(/\u001B\[[0-9;?]*[\u0020-\u002F]*[\u0040-\u007E]|\u001B\][^\u0007\u001B]*(?:\u0007|\u001B\\)/g, "");
6614
+ }
6615
+ function readSpawnDepth(raw) {
6616
+ const parsed = Number(raw);
6617
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : 0;
6618
+ }
6594
6619
  function stripBailArgs(bunArgs) {
6595
6620
  const sanitized = [];
6596
6621
  for (let i = 0;i < bunArgs.length; i++) {
@@ -6605,15 +6630,83 @@ function stripBailArgs(bunArgs) {
6605
6630
  }
6606
6631
  return sanitized;
6607
6632
  }
6633
+ var liveChildren = new Set;
6634
+ function killAllLiveChildren() {
6635
+ for (const child of liveChildren) {
6636
+ killProcessTree(child, "SIGKILL");
6637
+ }
6638
+ liveChildren.clear();
6639
+ }
6640
+ var CLEANUP_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
6641
+ var onCleanupSignal = (signal) => {
6642
+ killAllLiveChildren();
6643
+ removeSignalCleanup();
6644
+ process.kill(process.pid, signal);
6645
+ };
6646
+ function ensureSignalCleanup() {
6647
+ if (process.listeners(CLEANUP_SIGNALS[0]).includes(onCleanupSignal)) {
6648
+ return false;
6649
+ }
6650
+ for (const s of CLEANUP_SIGNALS) {
6651
+ process.on(s, onCleanupSignal);
6652
+ }
6653
+ return true;
6654
+ }
6655
+ function removeSignalCleanup() {
6656
+ for (const s of CLEANUP_SIGNALS) {
6657
+ process.off(s, onCleanupSignal);
6658
+ }
6659
+ }
6660
+ function killProcessTree(childProcess, signal) {
6661
+ const pid = childProcess.pid;
6662
+ if (pid === undefined || !killProcessGroup(pid, signal)) {
6663
+ childProcess.kill(signal);
6664
+ return false;
6665
+ }
6666
+ return true;
6667
+ }
6608
6668
  function killWithEscalation(childProcess, isClosed, gracePeriodMs) {
6609
- childProcess.kill("SIGTERM");
6610
- setTimeout(() => {
6669
+ const pid = childProcess.pid;
6670
+ const signalledGroup = killProcessTree(childProcess, "SIGTERM");
6671
+ let hasEscalated = false;
6672
+ const escalationHandle = setTimeout(() => {
6611
6673
  if (!isClosed()) {
6612
- childProcess.kill("SIGKILL");
6674
+ hasEscalated = true;
6675
+ killProcessTree(childProcess, "SIGKILL");
6613
6676
  }
6614
6677
  }, gracePeriodMs);
6678
+ return () => {
6679
+ clearTimeout(escalationHandle);
6680
+ if (!hasEscalated && signalledGroup && pid !== undefined) {
6681
+ hasEscalated = true;
6682
+ killProcessGroup(pid, "SIGKILL");
6683
+ }
6684
+ };
6615
6685
  }
6616
6686
  async function runBunTests(options) {
6687
+ const spawnDepth = readSpawnDepth(process.env[SPAWN_DEPTH_ENV]);
6688
+ const maxSpawnDepth = options.maxSpawnDepth ?? DEFAULT_MAX_SPAWN_DEPTH;
6689
+ if (!Number.isSafeInteger(maxSpawnDepth) || maxSpawnDepth < 1) {
6690
+ return {
6691
+ stdout: "",
6692
+ stderr: `stryker-bun-runner: invalid maxSpawnDepth=${String(maxSpawnDepth)}; expected a positive integer.`,
6693
+ exitCode: 1,
6694
+ timedOut: false,
6695
+ memoryLimitExceeded: false
6696
+ };
6697
+ }
6698
+ if (spawnDepth >= maxSpawnDepth) {
6699
+ return {
6700
+ stdout: "",
6701
+ stderr: `stryker-bun-runner: refusing to spawn \`bun test\` at nesting depth ${spawnDepth} (maxSpawnDepth=${maxSpawnDepth}). A test run spawned by this runner tried to spawn another one; this is almost always runaway recursion. See the bun.maxSpawnDepth option.`,
6702
+ exitCode: 1,
6703
+ timedOut: false,
6704
+ memoryLimitExceeded: false
6705
+ };
6706
+ }
6707
+ return spawnBunTests(options, spawnDepth);
6708
+ }
6709
+ async function spawnBunTests(options, spawnDepth) {
6617
6710
  const args = ["test"];
6618
6711
  if (options.inspectWaitPort) {
6619
6712
  args.push(`--inspect=127.0.0.1:${options.inspectWaitPort}`);
@@ -6655,7 +6748,8 @@ async function runBunTests(options) {
6655
6748
  if (options.syncPort) {
6656
6749
  env.__STRYKER_SYNC_PORT__ = String(options.syncPort);
6657
6750
  }
6658
- return new Promise((resolve3) => {
6751
+ env[SPAWN_DEPTH_ENV] = String(spawnDepth + 1);
6752
+ return new Promise((resolve) => {
6659
6753
  const stdoutChunks = [];
6660
6754
  const stderrChunks = [];
6661
6755
  let timedOut = false;
@@ -6663,34 +6757,44 @@ async function runBunTests(options) {
6663
6757
  let memoryLimitExceeded = false;
6664
6758
  let hasClosed = false;
6665
6759
  let rssIntervalHandle;
6760
+ let onLeaderExitDuringTermination;
6761
+ let onAbort;
6666
6762
  if (options.signal?.aborted) {
6667
- resolve3({ stdout: "", stderr: "", exitCode: null, timedOut: true, memoryLimitExceeded: false });
6763
+ resolve({ stdout: "", stderr: "", exitCode: null, timedOut: true, memoryLimitExceeded: false });
6668
6764
  return;
6669
6765
  }
6670
6766
  const spawnOpts = {
6671
6767
  env,
6672
6768
  stdio: ["ignore", "pipe", "pipe"],
6673
- cwd: process.cwd()
6769
+ cwd: process.cwd(),
6770
+ detached: true
6674
6771
  };
6675
6772
  const childProcess = spawn2(options.bunPath, args, spawnOpts);
6676
- const timeoutHandle = setTimeout(() => {
6677
- timedOut = true;
6773
+ liveChildren.add(childProcess);
6774
+ ensureSignalCleanup();
6775
+ const beginTermination = () => {
6776
+ if (processKilled) {
6777
+ return false;
6778
+ }
6678
6779
  processKilled = true;
6679
- killWithEscalation(childProcess, () => hasClosed, KILL_GRACE_PERIOD_MS);
6780
+ timedOut = true;
6781
+ onLeaderExitDuringTermination = killWithEscalation(childProcess, () => hasClosed, KILL_GRACE_PERIOD_MS);
6782
+ return true;
6783
+ };
6784
+ const timeoutHandle = setTimeout(() => {
6785
+ beginTermination();
6680
6786
  }, options.timeout);
6681
6787
  if (options.signal) {
6682
- const onAbort = () => {
6788
+ onAbort = () => {
6683
6789
  clearTimeout(timeoutHandle);
6684
- processKilled = true;
6685
- timedOut = true;
6686
- killWithEscalation(childProcess, () => hasClosed, KILL_GRACE_PERIOD_MS);
6790
+ beginTermination();
6687
6791
  };
6688
6792
  options.signal.addEventListener("abort", onAbort, { once: true });
6689
6793
  }
6690
6794
  if (options.maxChildRss !== undefined) {
6691
6795
  const rssLimit = options.maxChildRss;
6692
6796
  const checkMemoryCeiling = async () => {
6693
- if (hasClosed || memoryLimitExceeded) {
6797
+ if (hasClosed || processKilled) {
6694
6798
  return;
6695
6799
  }
6696
6800
  const pid = childProcess.pid;
@@ -6698,18 +6802,18 @@ async function runBunTests(options) {
6698
6802
  return;
6699
6803
  }
6700
6804
  const rssBytes = await getProcessRssBytes(pid);
6701
- if (rssBytes === null || hasClosed) {
6805
+ if (rssBytes === null || hasClosed || processKilled) {
6702
6806
  return;
6703
6807
  }
6704
6808
  if (rssBytes > rssLimit) {
6809
+ if (!beginTermination()) {
6810
+ return;
6811
+ }
6705
6812
  memoryLimitExceeded = true;
6706
- timedOut = true;
6707
- processKilled = true;
6708
6813
  if (rssIntervalHandle) {
6709
6814
  clearInterval(rssIntervalHandle);
6710
6815
  }
6711
6816
  options.onMemoryLimitExceeded?.(rssBytes);
6712
- killWithEscalation(childProcess, () => hasClosed, KILL_GRACE_PERIOD_MS);
6713
6817
  }
6714
6818
  };
6715
6819
  rssIntervalHandle = setInterval(() => {
@@ -6728,7 +6832,7 @@ async function runBunTests(options) {
6728
6832
  stderrChunks.push(data);
6729
6833
  if (options.inspectWaitPort && !inspectorUrlExtracted && options.onInspectorReady) {
6730
6834
  const text = Buffer.concat(stderrChunks).toString();
6731
- const match = /Listening:[\t\v\f\r \u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n\s*(ws:\/\/\S+)/.exec(text);
6835
+ const match = /Listening:[\t\v\f\r \u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n\s*(ws:\/\/\S+)/.exec(stripAnsi(text));
6732
6836
  if (match) {
6733
6837
  inspectorUrlExtracted = true;
6734
6838
  options.onInspectorReady(match[1]);
@@ -6736,13 +6840,21 @@ async function runBunTests(options) {
6736
6840
  }
6737
6841
  });
6738
6842
  }
6843
+ childProcess.on("exit", () => {
6844
+ onLeaderExitDuringTermination?.();
6845
+ });
6739
6846
  childProcess.on("close", (code) => {
6740
6847
  hasClosed = true;
6848
+ onLeaderExitDuringTermination?.();
6849
+ liveChildren.delete(childProcess);
6741
6850
  clearTimeout(timeoutHandle);
6851
+ if (options.signal && onAbort) {
6852
+ options.signal.removeEventListener("abort", onAbort);
6853
+ }
6742
6854
  if (rssIntervalHandle) {
6743
6855
  clearInterval(rssIntervalHandle);
6744
6856
  }
6745
- resolve3({
6857
+ resolve({
6746
6858
  stdout: Buffer.concat(stdoutChunks).toString(),
6747
6859
  stderr: Buffer.concat(stderrChunks).toString(),
6748
6860
  exitCode: processKilled ? null : code,
@@ -6752,12 +6864,17 @@ async function runBunTests(options) {
6752
6864
  });
6753
6865
  childProcess.on("error", (error) => {
6754
6866
  hasClosed = true;
6867
+ onLeaderExitDuringTermination?.();
6868
+ liveChildren.delete(childProcess);
6755
6869
  clearTimeout(timeoutHandle);
6870
+ if (options.signal && onAbort) {
6871
+ options.signal.removeEventListener("abort", onAbort);
6872
+ }
6756
6873
  if (rssIntervalHandle) {
6757
6874
  clearInterval(rssIntervalHandle);
6758
6875
  }
6759
6876
  const stderrOutput = Buffer.concat(stderrChunks).toString();
6760
- resolve3({
6877
+ resolve({
6761
6878
  stdout: Buffer.concat(stdoutChunks).toString(),
6762
6879
  stderr: `${stderrOutput}
6763
6880
  Process error: ${error.message}`,
@@ -6772,7 +6889,7 @@ Process error: ${error.message}`,
6772
6889
  // src/utils/port.ts
6773
6890
  import { createServer } from "node:net";
6774
6891
  async function getAvailablePort() {
6775
- return new Promise((resolve3, reject) => {
6892
+ return new Promise((resolve, reject) => {
6776
6893
  const server = createServer();
6777
6894
  server.on("error", (err) => {
6778
6895
  reject(new Error(`Failed to get available port: ${err.message}`));
@@ -6790,7 +6907,7 @@ async function getAvailablePort() {
6790
6907
  reject(new Error(`Failed to close server: ${err.message}`));
6791
6908
  return;
6792
6909
  }
6793
- resolve3(port);
6910
+ resolve(port);
6794
6911
  });
6795
6912
  });
6796
6913
  });
@@ -6822,7 +6939,7 @@ class SyncServer {
6822
6939
  this.webSocketOpenState = options.webSocketOpenState ?? import_websocket.default.OPEN;
6823
6940
  }
6824
6941
  async start() {
6825
- return new Promise((resolve3, reject) => {
6942
+ return new Promise((resolve, reject) => {
6826
6943
  try {
6827
6944
  this.httpServer = this.createHttpServer((req, res) => {
6828
6945
  if (req.url === "/sync") {
@@ -6855,7 +6972,7 @@ class SyncServer {
6855
6972
  });
6856
6973
  this.httpServer.on("error", reject);
6857
6974
  this.httpServer.listen(this.port, () => {
6858
- resolve3();
6975
+ resolve();
6859
6976
  });
6860
6977
  } catch (error) {
6861
6978
  reject(error instanceof Error ? error : new Error(String(error)));
@@ -6905,15 +7022,15 @@ class SyncServer {
6905
7022
  }
6906
7023
  this.clients.clear();
6907
7024
  if (this.wss) {
6908
- await new Promise((resolve3) => {
6909
- this.wss.close(() => resolve3());
7025
+ await new Promise((resolve) => {
7026
+ this.wss.close(() => resolve());
6910
7027
  });
6911
7028
  this.wss = null;
6912
7029
  }
6913
7030
  if (this.httpServer) {
6914
- await new Promise((resolve3) => {
7031
+ await new Promise((resolve) => {
6915
7032
  this.httpServer.close(() => {
6916
- resolve3();
7033
+ resolve();
6917
7034
  });
6918
7035
  });
6919
7036
  this.httpServer = null;
@@ -7363,7 +7480,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
7363
7480
  }
7364
7481
  return ptr;
7365
7482
  }
7366
- function skipUntil(str, ptr, sep2, end, banNewLines = false) {
7483
+ function skipUntil(str, ptr, sep, end, banNewLines = false) {
7367
7484
  if (!end) {
7368
7485
  ptr = indexOfNewline(str, ptr);
7369
7486
  return ptr < 0 ? str.length : ptr;
@@ -7372,7 +7489,7 @@ function skipUntil(str, ptr, sep2, end, banNewLines = false) {
7372
7489
  let c = str[i];
7373
7490
  if (c === "#") {
7374
7491
  i = indexOfNewline(str, i);
7375
- } else if (c === sep2) {
7492
+ } else if (c === sep) {
7376
7493
  return i + 1;
7377
7494
  } else if (c === end || banNewLines && (c === `
7378
7495
  ` || c === "\r" && str[i + 1] === `
@@ -7432,35 +7549,35 @@ function extractValue(str, ptr, end, depth, integersAsBigInt) {
7432
7549
  }
7433
7550
  let c = str[ptr];
7434
7551
  if (c === "[" || c === "{") {
7435
- let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
7552
+ let [value, endPtr] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
7436
7553
  if (end) {
7437
- endPtr2 = skipVoid(str, endPtr2);
7438
- if (str[endPtr2] === ",")
7439
- endPtr2++;
7440
- else if (str[endPtr2] !== end) {
7554
+ endPtr = skipVoid(str, endPtr);
7555
+ if (str[endPtr] === ",")
7556
+ endPtr++;
7557
+ else if (str[endPtr] !== end) {
7441
7558
  throw new TomlError("expected comma or end of structure", {
7442
7559
  toml: str,
7443
- ptr: endPtr2
7560
+ ptr: endPtr
7444
7561
  });
7445
7562
  }
7446
7563
  }
7447
- return [value, endPtr2];
7564
+ return [value, endPtr];
7448
7565
  }
7449
7566
  if (c === '"' || c === "'") {
7450
- let [parsed, endPtr2] = parseString(str, ptr);
7567
+ let [parsed, endPtr] = parseString(str, ptr);
7451
7568
  if (end) {
7452
- endPtr2 = skipVoid(str, endPtr2);
7453
- if (str[endPtr2] && str[endPtr2] !== "," && str[endPtr2] !== end && str[endPtr2] !== `
7454
- ` && str[endPtr2] !== "\r") {
7569
+ endPtr = skipVoid(str, endPtr);
7570
+ if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== `
7571
+ ` && str[endPtr] !== "\r") {
7455
7572
  throw new TomlError("unexpected character encountered", {
7456
7573
  toml: str,
7457
- ptr: endPtr2
7574
+ ptr: endPtr
7458
7575
  });
7459
7576
  }
7460
- if (str[endPtr2] === ",")
7461
- endPtr2++;
7577
+ if (str[endPtr] === ",")
7578
+ endPtr++;
7462
7579
  }
7463
- return [parsed, endPtr2];
7580
+ return [parsed, endPtr];
7464
7581
  }
7465
7582
  let endPtr = skipUntil(str, ptr, ",", end);
7466
7583
  let slice = sliceAndTrimEndOf(str, ptr, endPtr - (str[endPtr - 1] === "," ? 1 : 0));
@@ -8107,14 +8224,14 @@ async function handleSymlinkFile(fullPath, entryName, ctx) {
8107
8224
  }
8108
8225
  }
8109
8226
  async function handleSymlink(fullPath, entryName, ctx) {
8110
- const stat3 = await tryStat(fullPath);
8111
- if (!stat3) {
8227
+ const stat = await tryStat(fullPath);
8228
+ if (!stat) {
8112
8229
  ctx.logger?.debug("discoverTestFiles: broken symlink at %s; skipping", fullPath);
8113
8230
  return;
8114
8231
  }
8115
- if (stat3.isDirectory()) {
8232
+ if (stat.isDirectory()) {
8116
8233
  await handleSymlinkDir(fullPath, entryName, ctx);
8117
- } else if (stat3.isFile()) {
8234
+ } else if (stat.isFile()) {
8118
8235
  await handleSymlinkFile(fullPath, entryName, ctx);
8119
8236
  }
8120
8237
  }
@@ -8166,8 +8283,8 @@ async function discoverTestFiles(cwd = process.cwd(), logger) {
8166
8283
  }
8167
8284
  // src/bun-test-runner.ts
8168
8285
  function sleep(ms) {
8169
- return new Promise((resolve3) => {
8170
- setTimeout(resolve3, ms);
8286
+ return new Promise((resolve) => {
8287
+ setTimeout(resolve, ms);
8171
8288
  });
8172
8289
  }
8173
8290
  var DRAIN_ACK_SILENCE_TIMEOUT_MS = 4000;
@@ -8186,7 +8303,7 @@ class DrainWaitTimeoutError extends Error {
8186
8303
  function raceAgainstSilence(inspector, silenceMs, absoluteCeilingMs, message) {
8187
8304
  const startedAt = Date.now();
8188
8305
  let timer;
8189
- const promise2 = new Promise((_resolve, reject) => {
8306
+ const promise = new Promise((_resolve, reject) => {
8190
8307
  timer = setInterval(() => {
8191
8308
  const sinceLastFrame = inspector.getMsSinceLastFrame();
8192
8309
  const totalElapsed = Date.now() - startedAt;
@@ -8199,7 +8316,7 @@ function raceAgainstSilence(inspector, silenceMs, absoluteCeilingMs, message) {
8199
8316
  }
8200
8317
  }, DRAIN_SILENCE_POLL_INTERVAL_MS);
8201
8318
  });
8202
- return { promise: promise2, cancel: () => clearInterval(timer) };
8319
+ return { promise, cancel: () => clearInterval(timer) };
8203
8320
  }
8204
8321
  function formatGapIdList(gaps) {
8205
8322
  if (gaps.length === 0) {
@@ -8227,6 +8344,7 @@ var MAX_COVERAGE_BLEED_WARNINGS = 25;
8227
8344
  var EXECUTION_SHORTFALL_ABS_FLOOR = 10;
8228
8345
  var EXECUTION_SHORTFALL_RATIO_THRESHOLD = 0.05;
8229
8346
  var ORPHANED_KEY_ABS_FLOOR = 5;
8347
+ var TEST_ID_FILE_SEPARATOR = " > ";
8230
8348
  var INSPECTOR_DRAIN_TIMEOUT_MS = 1000;
8231
8349
 
8232
8350
  class BunTestRunner {
@@ -8242,6 +8360,7 @@ class BunTestRunner {
8242
8360
  smol;
8243
8361
  maxChildRss;
8244
8362
  rssCheckIntervalMs;
8363
+ maxSpawnDepth;
8245
8364
  preloadScriptPath;
8246
8365
  coverageFilePath;
8247
8366
  sanitizedBunfigPath;
@@ -8267,6 +8386,7 @@ class BunTestRunner {
8267
8386
  this.smol = bunOptions.smol ?? false;
8268
8387
  this.maxChildRss = bunOptions.maxChildRss;
8269
8388
  this.rssCheckIntervalMs = bunOptions.rssCheckIntervalMs;
8389
+ this.maxSpawnDepth = bunOptions.maxSpawnDepth;
8270
8390
  if (bunOptions.testFiles?.length === 0) {
8271
8391
  this.logger.warn("bun.testFiles was set to an empty array — treating as undefined and falling back to auto-discovery");
8272
8392
  this.testFilesOverride = undefined;
@@ -8282,7 +8402,8 @@ class BunTestRunner {
8282
8402
  bunArgs: this.bunArgs,
8283
8403
  smol: this.smol,
8284
8404
  maxChildRss: this.maxChildRss,
8285
- rssCheckIntervalMs: this.rssCheckIntervalMs
8405
+ rssCheckIntervalMs: this.rssCheckIntervalMs,
8406
+ maxSpawnDepth: this.maxSpawnDepth
8286
8407
  });
8287
8408
  if (this.testFilesOverride?.some((p) => path4.isAbsolute(p))) {
8288
8409
  const isSandbox = process.cwd().includes(".stryker-tmp/sandbox-");
@@ -8299,6 +8420,29 @@ class BunTestRunner {
8299
8420
  get registryTmpPath() {
8300
8421
  return `${this.registryPath}.tmp`;
8301
8422
  }
8423
+ resolveCoveringTestFiles(filterIds) {
8424
+ if (filterIds.length === 0) {
8425
+ return;
8426
+ }
8427
+ const discovered = this.cachedTestFiles;
8428
+ if (!discovered || discovered.length === 0) {
8429
+ return;
8430
+ }
8431
+ const discoveredSet = new Set(discovered);
8432
+ const files = new Set;
8433
+ for (const id of filterIds) {
8434
+ const sepIdx = id.indexOf(TEST_ID_FILE_SEPARATOR);
8435
+ if (sepIdx === -1) {
8436
+ return;
8437
+ }
8438
+ const file = id.slice(0, sepIdx);
8439
+ if (!discoveredSet.has(file)) {
8440
+ return;
8441
+ }
8442
+ files.add(file);
8443
+ }
8444
+ return [...files].toSorted((a, b) => a.localeCompare(b));
8445
+ }
8302
8446
  capabilities() {
8303
8447
  return {
8304
8448
  reloadEnvironment: true
@@ -8561,6 +8705,7 @@ ${stack}` : baseFailureMessage;
8561
8705
  smol: this.smol,
8562
8706
  maxChildRss: this.maxChildRss,
8563
8707
  rssCheckIntervalMs: this.rssCheckIntervalMs,
8708
+ maxSpawnDepth: this.maxSpawnDepth,
8564
8709
  onMemoryLimitExceeded: (rssBytes) => {
8565
8710
  this.logger.warn("bun test child exceeded maxChildRss (%d bytes observed) during dryRun — killing and reporting as a timeout for this run", rssBytes);
8566
8711
  },
@@ -8678,7 +8823,7 @@ exit=%s timedOut=%s
8678
8823
  const { coverage: mutantCoverage, inspectorIdToProjectFile, rawKeyCount, orphanedKeyCount } = await this.collectAndRemapCoverage(testHierarchy, executionOrder);
8679
8824
  const { tests, testNameIndex } = this.buildTestsFromInspector(testHierarchy, executionOrder, parsed, totalElapsedMs, inspectorIdToProjectFile);
8680
8825
  tests.sort((a, b) => a.name.localeCompare(b.name));
8681
- const gateResult = this.checkCompletenessGate(executionOrder, testHierarchy, parsed, rawKeyCount, orphanedKeyCount, wasClosedUnexpectedly, tests, closeInfo);
8826
+ const gateResult = this.checkCompletenessGate(executionOrder, testHierarchy, parsed, rawKeyCount, orphanedKeyCount, wasClosedUnexpectedly, tests, closeInfo, result.stderr);
8682
8827
  if (gateResult) {
8683
8828
  return gateResult;
8684
8829
  }
@@ -8762,9 +8907,9 @@ exit=%s timedOut=%s
8762
8907
  const mutantCwd = process.cwd();
8763
8908
  const bunfigPath = this.sanitizedBunfigPath && this.sanitizedBunfigCwd === mutantCwd ? this.sanitizedBunfigPath : await this.ensureSanitizedBunfig();
8764
8909
  this.cachedTestFiles = await this.getOrDiscoverTestFiles();
8765
- return this.executeMutantRun(options, bunfigPath, testNamePattern, localRegistry, localBaseIndex);
8910
+ return this.executeMutantRun(options, bunfigPath, testNamePattern, localRegistry, localBaseIndex, this.resolveCoveringTestFiles(filterIds));
8766
8911
  }
8767
- async executeMutantRun(options, bunfigPath, testNamePattern, localRegistry, localBaseIndex) {
8912
+ async executeMutantRun(options, bunfigPath, testNamePattern, localRegistry, localBaseIndex, coveringTestFiles) {
8768
8913
  const abortController = new AbortController;
8769
8914
  this.currentAbortController = abortController;
8770
8915
  let result;
@@ -8780,11 +8925,12 @@ exit=%s timedOut=%s
8780
8925
  sequentialMode: true,
8781
8926
  preloadScript: this.preloadScriptPath,
8782
8927
  testNamePattern,
8783
- testFiles: this.cachedTestFiles,
8928
+ testFiles: testNamePattern === undefined ? this.cachedTestFiles : coveringTestFiles ?? this.cachedTestFiles,
8784
8929
  signal: abortController.signal,
8785
8930
  smol: this.smol,
8786
8931
  maxChildRss: this.maxChildRss,
8787
8932
  rssCheckIntervalMs: this.rssCheckIntervalMs,
8933
+ maxSpawnDepth: this.maxSpawnDepth,
8788
8934
  onMemoryLimitExceeded: (rssBytes) => {
8789
8935
  this.logger.warn("bun test child exceeded maxChildRss (%d bytes observed) during mutant run %s — killing and reporting as a timeout for this mutant", rssBytes, options.activeMutant.id);
8790
8936
  }
@@ -8916,7 +9062,7 @@ ${lines.join(`
8916
9062
  %s`, String(result.exitCode), parsed.failed, result.stderr.slice(-500));
8917
9063
  }
8918
9064
  }
8919
- checkCompletenessGate(executionOrder, testHierarchy, parsed, rawKeyCount, orphanedKeyCount, wasClosedUnexpectedly, tests, closeInfo) {
9065
+ checkCompletenessGate(executionOrder, testHierarchy, parsed, rawKeyCount, orphanedKeyCount, wasClosedUnexpectedly, tests, closeInfo, stderr) {
8920
9066
  if (tests.some((t) => t.status === TestStatus.Failed)) {
8921
9067
  return null;
8922
9068
  }
@@ -8929,7 +9075,8 @@ ${lines.join(`
8929
9075
  const shortfall = consoleTotal - nonSkippedExecutionCount;
8930
9076
  const signalA = consoleTotal > 0 && shortfall > EXECUTION_SHORTFALL_ABS_FLOOR && shortfall / consoleTotal > EXECUTION_SHORTFALL_RATIO_THRESHOLD;
8931
9077
  const signalB = orphanedKeyCount > ORPHANED_KEY_ABS_FLOOR;
8932
- if (!signalA && !signalB) {
9078
+ const signalC = parsed.summaryFailed > 0;
9079
+ if (!signalA && !signalB && !signalC) {
8933
9080
  return null;
8934
9081
  }
8935
9082
  const reasons = [];
@@ -8939,6 +9086,10 @@ ${lines.join(`
8939
9086
  if (signalB) {
8940
9087
  reasons.push(`${orphanedKeyCount} of ${rawKeyCount} coverage key(s) could not be paired with any inspector test (orphaned)`);
8941
9088
  }
9089
+ if (signalC) {
9090
+ reasons.push(`bun's console summary reported ${parsed.summaryFailed} failing test(s), but none of them could be ` + "attributed to an individual test — a whole spec file that fails to load (e.g. an unresolvable " + `import) produces exactly this shape. Last 500 chars of stderr:
9091
+ ${stderr.slice(-500)}`);
9092
+ }
8942
9093
  if (wasClosedUnexpectedly) {
8943
9094
  const closeDetail = closeInfo.code === undefined ? "close code/reason not captured" : `close code=${closeInfo.code} reason=${JSON.stringify(closeInfo.reason ?? "")} wasClean=${String(closeInfo.wasClean)}, ${String(closeInfo.msFromLastFrameToClose)}ms after the last received frame`;
8944
9095
  reasons.push(`the inspector WebSocket closed unexpectedly before this data could be fully drained (${closeDetail})`);
@@ -9135,6 +9286,12 @@ var strykerValidationSchema = {
9135
9286
  minimum: 0,
9136
9287
  description: "Poll interval in milliseconds for the maxChildRss check (default: 1000).",
9137
9288
  default: 1000
9289
+ },
9290
+ maxSpawnDepth: {
9291
+ type: "integer",
9292
+ minimum: 1,
9293
+ description: "Maximum `bun test` spawn nesting depth before the runner refuses to spawn (default: 1). Guards against runaway recursion when a run spawned by this runner ends up spawning another one. Raise to 2 only if your own tests drive this runner.",
9294
+ default: 1
9138
9295
  }
9139
9296
  },
9140
9297
  additionalProperties: false
@@ -9142,7 +9299,7 @@ var strykerValidationSchema = {
9142
9299
  }
9143
9300
  };
9144
9301
  export {
9145
- strykerValidationSchema,
9302
+ BunTestRunner,
9146
9303
  strykerPlugins,
9147
- BunTestRunner
9304
+ strykerValidationSchema
9148
9305
  };