@hughescr/stryker-bun-runner 1.3.3 → 1.3.4

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/README.md CHANGED
@@ -153,7 +153,7 @@ Stryker core's own [`maxTestRunnerReuse`](https://stryker-mutator.io/docs/stryke
153
153
  This plugin is designed to tolerate that recycling cleanly:
154
154
 
155
155
  - `dispose()` cleans up its preload script, coverage file, sanitized bunfig, and registry temp file, and aborts any run still in flight (see [Orphan prevention](#orphan-prevention)).
156
- - A fresh `BunTestRunner` instance that never ran its own `dryRun` (as happens after a recycle) still resolves `killedBy` names correctly: it lazily loads the shared, file-backed dry-run test registry written by whichever instance *did* run `dryRun`, exactly as it already does for any other multi-worker Stryker run.
156
+ - A fresh `BunTestRunner` instance that never ran its own `dryRun` (as happens after a recycle) still resolves `killedBy` names correctly: it lazily loads the shared, file-backed dry-run test registry written by whichever instance *did* run `dryRun`, exactly as it already does for any other multi-worker Stryker run. The registry lives in the OS temp directory, not the project directory, keyed to this Stryker run so it can't collide with another run's registry or a different project's — a recycled instance is still a child of the same Stryker main process, so it derives the same key and finds the same file.
157
157
 
158
158
  ```javascript
159
159
  // stryker.conf.mjs
package/dist/index.d.ts CHANGED
@@ -47,9 +47,47 @@ export declare class BunTestRunner implements TestRunner {
47
47
  constructor(logger: Logger, options: StrykerOptions);
48
48
  /**
49
49
  * Single source of truth for the registry file name.
50
- * Using getters that read process.cwd() at call time ensures the path
51
- * resolves to Stryker's sandbox directory — which is set by the time these
52
- * are invoked — rather than the orchestrator's cwd at module-load time.
50
+ *
51
+ * Lives in the OS temp directory, not cwd: under Stryker's --inPlace mode
52
+ * cwd IS the user's real project root, and writing there would both
53
+ * pollute the user's project and never get cleaned up (dispose()
54
+ * deliberately never unlinks the registry itself — see its doc comment).
55
+ * The temp directory is OS-managed instead.
56
+ *
57
+ * Keyed by sha256(cwd + ':' + ppid): every worker process Stryker spawns
58
+ * for one run is a direct child of that run's single Stryker main
59
+ * process, so all of them share BOTH process.cwd() (the sandbox
60
+ * directory) AND process.ppid (the main process's pid) — and therefore
61
+ * independently derive this SAME path with no coordination required. A
62
+ * worker recycled mid-run is still a child of the same main process, so
63
+ * it re-derives the same path too (README documents recycled instances
64
+ * lazily loading the registry). This is the entire sharing contract:
65
+ * writer (buildAndPersistTestRegistry) and reader (loadRegistryFile) both
66
+ * go through this one getter rather than reimplementing the formula, so
67
+ * they can never disagree by construction.
68
+ *
69
+ * process.ppid is what makes this safe for this repo's own dogfooding:
70
+ * this plugin's own unit/integration tests run INSIDE a Stryker sandbox as
71
+ * the system under test, as children of the sandbox WORKER process, not
72
+ * of the Stryker main process — so those inner test processes hash a
73
+ * different ppid and land on a different file, and can never clobber the
74
+ * outer run's registry. A worker-unique key (e.g. the STRYKER_MUTATOR_WORKER
75
+ * env var Stryker injects per forked worker) was considered and rejected
76
+ * for the same reason it would break the cross-worker sharing above: it
77
+ * uniquely identifies each worker, not the run.
78
+ *
79
+ * process.cwd() is read directly (not resolved via fs.realpathSync):
80
+ * Stryker's child-process-proxy-worker computes every worker's chdir
81
+ * target via a pure path.resolve() of an identical IPC string, so all
82
+ * workers of a run already get a byte-identical process.cwd() with no
83
+ * symlink divergence to guard against — realpath would only add a
84
+ * syscall (and a new ENOENT failure mode if the sandbox dir is mid-
85
+ * teardown) for no benefit.
86
+ *
87
+ * Using a getter that reads process.cwd()/process.ppid at call time
88
+ * (rather than caching at construction) ensures the path resolves against
89
+ * Stryker's sandbox directory — which is set by the time these are
90
+ * invoked — rather than the orchestrator's cwd at module-load time.
53
91
  */
54
92
  private get registryPath();
55
93
  private get registryTmpPath();
package/dist/index.js CHANGED
@@ -2320,6 +2320,8 @@ var require_receiver = __commonJS((exports, module) => {
2320
2320
  this._binaryType = options.binaryType || BINARY_TYPES[0];
2321
2321
  this._extensions = options.extensions || {};
2322
2322
  this._isServer = !!options.isServer;
2323
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
2324
+ this._maxFragments = options.maxFragments | 0;
2323
2325
  this._maxPayload = options.maxPayload | 0;
2324
2326
  this._skipUTF8Validation = !!options.skipUTF8Validation;
2325
2327
  this[kWebSocket] = undefined;
@@ -2342,6 +2344,10 @@ var require_receiver = __commonJS((exports, module) => {
2342
2344
  _write(chunk, encoding, cb) {
2343
2345
  if (this._opcode === 8 && this._state == GET_INFO)
2344
2346
  return cb();
2347
+ if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
2348
+ cb(this.createError(RangeError, "Too many buffered chunks", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS"));
2349
+ return;
2350
+ }
2345
2351
  this._bufferedBytes += chunk.length;
2346
2352
  this._buffers.push(chunk);
2347
2353
  this.startLoop(cb);
@@ -2545,6 +2551,11 @@ var require_receiver = __commonJS((exports, module) => {
2545
2551
  return;
2546
2552
  }
2547
2553
  if (data.length) {
2554
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
2555
+ const error = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
2556
+ cb(error);
2557
+ return;
2558
+ }
2548
2559
  this._messageLength = this._totalPayloadLength;
2549
2560
  this._fragments.push(data);
2550
2561
  }
@@ -2562,6 +2573,11 @@ var require_receiver = __commonJS((exports, module) => {
2562
2573
  cb(error);
2563
2574
  return;
2564
2575
  }
2576
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
2577
+ const error = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
2578
+ cb(error);
2579
+ return;
2580
+ }
2565
2581
  this._fragments.push(buf);
2566
2582
  }
2567
2583
  this.dataMessage(cb);
@@ -2677,6 +2693,9 @@ var require_receiver = __commonJS((exports, module) => {
2677
2693
  var require_sender = __commonJS((exports, module) => {
2678
2694
  var { Duplex } = __require("stream");
2679
2695
  var { randomFillSync } = __require("crypto");
2696
+ var {
2697
+ types: { isUint8Array }
2698
+ } = __require("util");
2680
2699
  var PerMessageDeflate = require_permessage_deflate();
2681
2700
  var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants2();
2682
2701
  var { isBlob, isValidStatusCode } = require_validation();
@@ -2796,8 +2815,10 @@ var require_sender = __commonJS((exports, module) => {
2796
2815
  buf.writeUInt16BE(code, 0);
2797
2816
  if (typeof data === "string") {
2798
2817
  buf.write(data, 2);
2799
- } else {
2818
+ } else if (isUint8Array(data)) {
2800
2819
  buf.set(data, 2);
2820
+ } else {
2821
+ throw new TypeError("Second argument must be a string or a Uint8Array");
2801
2822
  }
2802
2823
  }
2803
2824
  const options = {
@@ -3464,6 +3485,8 @@ var require_websocket = __commonJS((exports, module) => {
3464
3485
  binaryType: this.binaryType,
3465
3486
  extensions: this._extensions,
3466
3487
  isServer: this._isServer,
3488
+ maxBufferedChunks: options.maxBufferedChunks,
3489
+ maxFragments: options.maxFragments,
3467
3490
  maxPayload: options.maxPayload,
3468
3491
  skipUTF8Validation: options.skipUTF8Validation
3469
3492
  });
@@ -3706,6 +3729,8 @@ var require_websocket = __commonJS((exports, module) => {
3706
3729
  autoPong: true,
3707
3730
  closeTimeout: CLOSE_TIMEOUT,
3708
3731
  protocolVersion: protocolVersions[1],
3732
+ maxBufferedChunks: 1024 * 1024,
3733
+ maxFragments: 128 * 1024,
3709
3734
  maxPayload: 100 * 1024 * 1024,
3710
3735
  skipUTF8Validation: false,
3711
3736
  perMessageDeflate: true,
@@ -3944,6 +3969,8 @@ var require_websocket = __commonJS((exports, module) => {
3944
3969
  websocket.setSocket(socket, head, {
3945
3970
  allowSynchronousEvents: opts.allowSynchronousEvents,
3946
3971
  generateMask: opts.generateMask,
3972
+ maxBufferedChunks: opts.maxBufferedChunks,
3973
+ maxFragments: opts.maxFragments,
3947
3974
  maxPayload: opts.maxPayload,
3948
3975
  skipUTF8Validation: opts.skipUTF8Validation
3949
3976
  });
@@ -4279,6 +4306,8 @@ var require_websocket_server = __commonJS((exports, module) => {
4279
4306
  options = {
4280
4307
  allowSynchronousEvents: true,
4281
4308
  autoPong: true,
4309
+ maxBufferedChunks: 1024 * 1024,
4310
+ maxFragments: 128 * 1024,
4282
4311
  maxPayload: 100 * 1024 * 1024,
4283
4312
  skipUTF8Validation: false,
4284
4313
  perMessageDeflate: false,
@@ -4505,6 +4534,8 @@ var require_websocket_server = __commonJS((exports, module) => {
4505
4534
  socket.removeListener("error", socketOnError);
4506
4535
  ws.setSocket(socket, head, {
4507
4536
  allowSynchronousEvents: this.options.allowSynchronousEvents,
4537
+ maxBufferedChunks: this.options.maxBufferedChunks,
4538
+ maxFragments: this.options.maxFragments,
4508
4539
  maxPayload: this.options.maxPayload,
4509
4540
  skipUTF8Validation: this.options.skipUTF8Validation
4510
4541
  });
@@ -4604,6 +4635,7 @@ var Scope;
4604
4635
  Scope2["Singleton"] = "singleton";
4605
4636
  })(Scope || (Scope = {}));
4606
4637
  // src/bun-test-runner.ts
4638
+ import { createHash } from "node:crypto";
4607
4639
  import * as fsPromises2 from "node:fs/promises";
4608
4640
  import { tmpdir } from "node:os";
4609
4641
  import path4 from "node:path";
@@ -5176,6 +5208,7 @@ var Builder = class {
5176
5208
  var import_picomatch = __toESM(require_picomatch2(), 1);
5177
5209
  var isReadonlyArray = Array.isArray;
5178
5210
  var BACKSLASHES = /\\/g;
5211
+ var DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
5179
5212
  var isWin = process.platform === "win32";
5180
5213
  var ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
5181
5214
  function getPartialMatcher(patterns, options = {}) {
@@ -5250,6 +5283,9 @@ function buildRelative(cwd, root) {
5250
5283
  return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
5251
5284
  };
5252
5285
  }
5286
+ function ensureNonDriveRelativePath(path) {
5287
+ return path.replace(DRIVE_RELATIVE_PATH, (match) => `${match}/`);
5288
+ }
5253
5289
  var splitPatternOptions = { parts: true };
5254
5290
  function splitPattern(path) {
5255
5291
  var _result$parts;
@@ -5297,7 +5333,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
5297
5333
  }
5298
5334
  const potentialRoot = posix.join(cwd, parentDir.slice(i * 3));
5299
5335
  if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
5300
- props.root = potentialRoot;
5336
+ props.root = ensureNonDriveRelativePath(potentialRoot);
5301
5337
  props.depthOffset = -n + i;
5302
5338
  }
5303
5339
  }
@@ -5318,7 +5354,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
5318
5354
  }
5319
5355
  props.depthOffset = newCommonPath.length;
5320
5356
  props.commonPath = newCommonPath;
5321
- props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
5357
+ props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd);
5322
5358
  }
5323
5359
  return result;
5324
5360
  }
@@ -5418,18 +5454,17 @@ function formatPaths(paths, mapper) {
5418
5454
  }
5419
5455
  var defaultOptions = {
5420
5456
  caseSensitiveMatch: true,
5421
- cwd: process.cwd(),
5422
5457
  debug: !!process.env.TINYGLOBBY_DEBUG,
5423
5458
  expandDirectories: true,
5424
5459
  followSymbolicLinks: true,
5425
5460
  onlyFiles: true
5426
5461
  };
5427
5462
  function getOptions(options) {
5428
- const opts = {
5429
- ...defaultOptions,
5430
- ...options
5431
- };
5432
- opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve2(opts.cwd)).replace(BACKSLASHES, "/");
5463
+ const opts = Object.assign({}, options);
5464
+ for (const key in defaultOptions)
5465
+ if (opts[key] === undefined)
5466
+ Object.assign(opts, { [key]: defaultOptions[key] });
5467
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve2(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
5433
5468
  opts.ignore = ensureStringArray(opts.ignore);
5434
5469
  opts.fs && (opts.fs = {
5435
5470
  readdir: opts.fs.readdir || readdir,
@@ -5505,7 +5540,6 @@ async function cleanupPreloadScript(preloadPath) {
5505
5540
  await unlink(preloadPath);
5506
5541
  } catch {}
5507
5542
  }
5508
-
5509
5543
  // src/coverage/collector.ts
5510
5544
  import { readFile as readFile2, unlink as unlink2 } from "node:fs/promises";
5511
5545
  function arrayToCoverageData(mutantIds) {
@@ -5590,7 +5624,6 @@ async function cleanupCoverageFile(coverageFile) {
5590
5624
  await unlink2(coverageFile);
5591
5625
  } catch {}
5592
5626
  }
5593
-
5594
5627
  // src/utils/duplicate-suffix.ts
5595
5628
  function buildDiscoveryOrderIndex(discoveryOrderedIds) {
5596
5629
  const index = new Map;
@@ -5916,7 +5949,6 @@ function mapLegacyCounterKeys(rawCoverage, executionOrder, testHierarchy, logger
5916
5949
  perTest: remappedPerTest
5917
5950
  });
5918
5951
  }
5919
-
5920
5952
  // node_modules/ws/wrapper.mjs
5921
5953
  var import_stream = __toESM(require_stream(), 1);
5922
5954
  var import_extension = __toESM(require_extension(), 1);
@@ -6718,189 +6750,6 @@ class SyncServer {
6718
6750
  import { readFile as readFile4, unlink as unlink3, writeFile as writeFile2, mkdir as mkdir2 } from "node:fs/promises";
6719
6751
  import path2 from "node:path";
6720
6752
 
6721
- // node_modules/smol-toml/dist/error.js
6722
- /*!
6723
- * Copyright (c) Squirrel Chat et al., All rights reserved.
6724
- * SPDX-License-Identifier: BSD-3-Clause
6725
- *
6726
- * Redistribution and use in source and binary forms, with or without
6727
- * modification, are permitted provided that the following conditions are met:
6728
- *
6729
- * 1. Redistributions of source code must retain the above copyright notice, this
6730
- * list of conditions and the following disclaimer.
6731
- * 2. Redistributions in binary form must reproduce the above copyright notice,
6732
- * this list of conditions and the following disclaimer in the
6733
- * documentation and/or other materials provided with the distribution.
6734
- * 3. Neither the name of the copyright holder nor the names of its contributors
6735
- * may be used to endorse or promote products derived from this software without
6736
- * specific prior written permission.
6737
- *
6738
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
6739
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6740
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6741
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
6742
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
6743
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
6744
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
6745
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
6746
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
6747
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6748
- */
6749
- function getLineColFromPtr(string, ptr) {
6750
- let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
6751
- return [lines.length, lines.pop().length + 1];
6752
- }
6753
- function makeCodeBlock(string, line, column) {
6754
- let lines = string.split(/\r\n|\n|\r/g);
6755
- let codeblock = "";
6756
- let numberLen = (Math.log10(line + 1) | 0) + 1;
6757
- for (let i = line - 1;i <= line + 1; i++) {
6758
- let l = lines[i - 1];
6759
- if (!l)
6760
- continue;
6761
- codeblock += i.toString().padEnd(numberLen, " ");
6762
- codeblock += ": ";
6763
- codeblock += l;
6764
- codeblock += `
6765
- `;
6766
- if (i === line) {
6767
- codeblock += " ".repeat(numberLen + column + 2);
6768
- codeblock += `^
6769
- `;
6770
- }
6771
- }
6772
- return codeblock;
6773
- }
6774
-
6775
- class TomlError extends Error {
6776
- line;
6777
- column;
6778
- codeblock;
6779
- constructor(message, options) {
6780
- const [line, column] = getLineColFromPtr(options.toml, options.ptr);
6781
- const codeblock = makeCodeBlock(options.toml, line, column);
6782
- super(`Invalid TOML document: ${message}
6783
-
6784
- ${codeblock}`, options);
6785
- this.line = line;
6786
- this.column = column;
6787
- this.codeblock = codeblock;
6788
- }
6789
- }
6790
-
6791
- // node_modules/smol-toml/dist/util.js
6792
- /*!
6793
- * Copyright (c) Squirrel Chat et al., All rights reserved.
6794
- * SPDX-License-Identifier: BSD-3-Clause
6795
- *
6796
- * Redistribution and use in source and binary forms, with or without
6797
- * modification, are permitted provided that the following conditions are met:
6798
- *
6799
- * 1. Redistributions of source code must retain the above copyright notice, this
6800
- * list of conditions and the following disclaimer.
6801
- * 2. Redistributions in binary form must reproduce the above copyright notice,
6802
- * this list of conditions and the following disclaimer in the
6803
- * documentation and/or other materials provided with the distribution.
6804
- * 3. Neither the name of the copyright holder nor the names of its contributors
6805
- * may be used to endorse or promote products derived from this software without
6806
- * specific prior written permission.
6807
- *
6808
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
6809
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6810
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6811
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
6812
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
6813
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
6814
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
6815
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
6816
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
6817
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6818
- */
6819
- function isEscaped(str, ptr) {
6820
- let i = 0;
6821
- while (str[ptr - ++i] === "\\")
6822
- ;
6823
- return --i && i % 2;
6824
- }
6825
- function indexOfNewline(str, start = 0, end = str.length) {
6826
- let idx = str.indexOf(`
6827
- `, start);
6828
- if (str[idx - 1] === "\r")
6829
- idx--;
6830
- return idx <= end ? idx : -1;
6831
- }
6832
- function skipComment(str, ptr) {
6833
- for (let i = ptr;i < str.length; i++) {
6834
- let c = str[i];
6835
- if (c === `
6836
- `)
6837
- return i;
6838
- if (c === "\r" && str[i + 1] === `
6839
- `)
6840
- return i + 1;
6841
- if (c < " " && c !== "\t" || c === "") {
6842
- throw new TomlError("control characters are not allowed in comments", {
6843
- toml: str,
6844
- ptr
6845
- });
6846
- }
6847
- }
6848
- return str.length;
6849
- }
6850
- function skipVoid(str, ptr, banNewLines, banComments) {
6851
- let c;
6852
- while (true) {
6853
- while ((c = str[ptr]) === " " || c === "\t" || !banNewLines && (c === `
6854
- ` || c === "\r" && str[ptr + 1] === `
6855
- `))
6856
- ptr++;
6857
- if (banComments || c !== "#")
6858
- break;
6859
- ptr = skipComment(str, ptr);
6860
- }
6861
- return ptr;
6862
- }
6863
- function skipUntil(str, ptr, sep2, end, banNewLines = false) {
6864
- if (!end) {
6865
- ptr = indexOfNewline(str, ptr);
6866
- return ptr < 0 ? str.length : ptr;
6867
- }
6868
- for (let i = ptr;i < str.length; i++) {
6869
- let c = str[i];
6870
- if (c === "#") {
6871
- i = indexOfNewline(str, i);
6872
- } else if (c === sep2) {
6873
- return i + 1;
6874
- } else if (c === end || banNewLines && (c === `
6875
- ` || c === "\r" && str[i + 1] === `
6876
- `)) {
6877
- return i;
6878
- }
6879
- }
6880
- throw new TomlError("cannot find end of structure", {
6881
- toml: str,
6882
- ptr
6883
- });
6884
- }
6885
- function getStringEnd(str, seek) {
6886
- let first = str[seek];
6887
- let target2 = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
6888
- seek += target2.length - 1;
6889
- do
6890
- seek = str.indexOf(target2, ++seek);
6891
- while (seek > -1 && first !== "'" && isEscaped(str, seek));
6892
- if (seek > -1) {
6893
- seek += target2.length;
6894
- if (target2.length > 1) {
6895
- if (str[seek] === first)
6896
- seek++;
6897
- if (str[seek] === first)
6898
- seek++;
6899
- }
6900
- }
6901
- return seek;
6902
- }
6903
-
6904
6753
  // node_modules/smol-toml/dist/date.js
6905
6754
  /*!
6906
6755
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -7021,6 +6870,76 @@ class TomlDate extends Date {
7021
6870
  }
7022
6871
  }
7023
6872
 
6873
+ // node_modules/smol-toml/dist/error.js
6874
+ /*!
6875
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
6876
+ * SPDX-License-Identifier: BSD-3-Clause
6877
+ *
6878
+ * Redistribution and use in source and binary forms, with or without
6879
+ * modification, are permitted provided that the following conditions are met:
6880
+ *
6881
+ * 1. Redistributions of source code must retain the above copyright notice, this
6882
+ * list of conditions and the following disclaimer.
6883
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
6884
+ * this list of conditions and the following disclaimer in the
6885
+ * documentation and/or other materials provided with the distribution.
6886
+ * 3. Neither the name of the copyright holder nor the names of its contributors
6887
+ * may be used to endorse or promote products derived from this software without
6888
+ * specific prior written permission.
6889
+ *
6890
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
6891
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6892
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6893
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
6894
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
6895
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
6896
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
6897
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
6898
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
6899
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6900
+ */
6901
+ function getLineColFromPtr(string, ptr) {
6902
+ let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
6903
+ return [lines.length, lines.pop().length + 1];
6904
+ }
6905
+ function makeCodeBlock(string, line, column) {
6906
+ let lines = string.split(/\r\n|\n|\r/g);
6907
+ let codeblock = "";
6908
+ let numberLen = (Math.log10(line + 1) | 0) + 1;
6909
+ for (let i = line - 1;i <= line + 1; i++) {
6910
+ let l = lines[i - 1];
6911
+ if (!l)
6912
+ continue;
6913
+ codeblock += i.toString().padEnd(numberLen, " ");
6914
+ codeblock += ": ";
6915
+ codeblock += l;
6916
+ codeblock += `
6917
+ `;
6918
+ if (i === line) {
6919
+ codeblock += " ".repeat(numberLen + column + 2);
6920
+ codeblock += `^
6921
+ `;
6922
+ }
6923
+ }
6924
+ return codeblock;
6925
+ }
6926
+
6927
+ class TomlError extends Error {
6928
+ line;
6929
+ column;
6930
+ codeblock;
6931
+ constructor(message, options) {
6932
+ const [line, column] = getLineColFromPtr(options.toml, options.ptr);
6933
+ const codeblock = makeCodeBlock(options.toml, line, column);
6934
+ super(`Invalid TOML document: ${message}
6935
+
6936
+ ${codeblock}`, options);
6937
+ this.line = line;
6938
+ this.column = column;
6939
+ this.codeblock = codeblock;
6940
+ }
6941
+ }
6942
+
7024
6943
  // node_modules/smol-toml/dist/primitive.js
7025
6944
  /*!
7026
6945
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -7052,95 +6971,103 @@ class TomlDate extends Date {
7052
6971
  var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
7053
6972
  var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
7054
6973
  var LEADING_ZERO = /^[+-]?0[0-9_]/;
7055
- var ESCAPE_REGEX = /^[0-9a-f]{2,8}$/i;
7056
- var ESC_MAP = {
7057
- b: "\b",
7058
- t: "\t",
7059
- n: `
7060
- `,
7061
- f: "\f",
7062
- r: "\r",
7063
- e: "\x1B",
7064
- '"': '"',
7065
- "\\": "\\"
7066
- };
7067
- function parseString(str, ptr = 0, endPtr = str.length) {
7068
- let isLiteral = str[ptr] === "'";
7069
- let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
6974
+ function parseString(str, ptr) {
6975
+ let c = str[ptr++];
6976
+ let first = c;
6977
+ let isLiteral = c === "'";
6978
+ let isMultiline = c === str[ptr] && c === str[ptr + 1];
7070
6979
  if (isMultiline) {
7071
- endPtr -= 2;
7072
- if (str[ptr += 2] === "\r")
7073
- ptr++;
7074
- if (str[ptr] === `
6980
+ if (str[ptr += 2] === `
7075
6981
  `)
7076
6982
  ptr++;
6983
+ else if (str[ptr] === "\r" && str[ptr + 1] === `
6984
+ `)
6985
+ ptr += 2;
7077
6986
  }
7078
- let tmp = 0;
7079
- let isEscape;
7080
6987
  let parsed = "";
7081
6988
  let sliceStart = ptr;
7082
- while (ptr < endPtr - 1) {
7083
- let c = str[ptr++];
7084
- if (c === `
7085
- ` || c === "\r" && str[ptr] === `
7086
- `) {
7087
- if (!isMultiline) {
7088
- throw new TomlError("newlines are not allowed in strings", {
7089
- toml: str,
7090
- ptr: ptr - 1
7091
- });
7092
- }
6989
+ let state = 0;
6990
+ for (let i = ptr;i < str.length; i++) {
6991
+ c = str[i];
6992
+ if (isMultiline && (c === `
6993
+ ` || c === "\r" && str[i + 1] === `
6994
+ `)) {
6995
+ state = state && 3;
7093
6996
  } else if (c < " " && c !== "\t" || c === "") {
7094
6997
  throw new TomlError("control characters are not allowed in strings", {
7095
6998
  toml: str,
7096
- ptr: ptr - 1
6999
+ ptr: i
7097
7000
  });
7098
- }
7099
- if (isEscape) {
7100
- isEscape = false;
7001
+ } else if ((!state || state === 3) && c === first && (!isMultiline || str[i + 1] === first && str[i + 2] === first)) {
7002
+ if (isMultiline) {
7003
+ if (str[i + 3] === first)
7004
+ i++;
7005
+ if (str[i + 3] === first)
7006
+ i++;
7007
+ }
7008
+ return [
7009
+ state ? parsed : parsed + str.slice(sliceStart, i),
7010
+ i + (isMultiline ? 3 : 1)
7011
+ ];
7012
+ } else if (!state) {
7013
+ if (!isLiteral && c === "\\") {
7014
+ parsed += str.slice(sliceStart, sliceStart = i);
7015
+ state = 1;
7016
+ }
7017
+ } else if (state === 1) {
7101
7018
  if (c === "x" || c === "u" || c === "U") {
7102
- let code = str.slice(ptr, ptr += c === "x" ? 2 : c === "u" ? 4 : 8);
7103
- if (!ESCAPE_REGEX.test(code)) {
7104
- throw new TomlError("invalid unicode escape", {
7105
- toml: str,
7106
- ptr: tmp
7107
- });
7108
- }
7109
- try {
7110
- parsed += String.fromCodePoint(parseInt(code, 16));
7111
- } catch {
7112
- throw new TomlError("invalid unicode escape", {
7113
- toml: str,
7114
- ptr: tmp
7115
- });
7116
- }
7117
- } else if (isMultiline && (c === `
7118
- ` || c === " " || c === "\t" || c === "\r")) {
7119
- ptr = skipVoid(str, ptr - 1, true);
7120
- if (str[ptr] !== `
7121
- ` && str[ptr] !== "\r") {
7122
- throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
7123
- toml: str,
7124
- ptr: tmp
7125
- });
7126
- }
7127
- ptr = skipVoid(str, ptr);
7128
- } else if (c in ESC_MAP) {
7129
- parsed += ESC_MAP[c];
7019
+ let value = 0;
7020
+ let len = c === "x" ? 2 : c === "u" ? 4 : 8;
7021
+ for (let j = 0;j < len; j++, i++) {
7022
+ let hex = str.charCodeAt(i + 1);
7023
+ let digit = hex >= 48 && hex <= 57 ? hex - 48 : hex >= 65 && hex <= 70 ? hex - 65 + 10 : hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1;
7024
+ if (digit < 0)
7025
+ throw new TomlError("invalid non-hex character in unicode escape", { toml: str, ptr: i + 1 });
7026
+ value = value << 4 | digit;
7027
+ }
7028
+ if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
7029
+ throw new TomlError("invalid unicode escape", { toml: str, ptr: i });
7030
+ }
7031
+ parsed += String.fromCodePoint(value);
7032
+ sliceStart = i + 1;
7033
+ state = 0;
7034
+ } else if (c === " " || c === "\t") {
7035
+ state = 2;
7130
7036
  } else {
7131
- throw new TomlError("unrecognized escape sequence", {
7037
+ if (c === "b")
7038
+ parsed += "\b";
7039
+ else if (c === "t")
7040
+ parsed += "\t";
7041
+ else if (c === "n")
7042
+ parsed += `
7043
+ `;
7044
+ else if (c === "f")
7045
+ parsed += "\f";
7046
+ else if (c === "r")
7047
+ parsed += "\r";
7048
+ else if (c === "e")
7049
+ parsed += "\x1B";
7050
+ else if (c === '"')
7051
+ parsed += '"';
7052
+ else if (c === "\\")
7053
+ parsed += "\\";
7054
+ else
7055
+ throw new TomlError("unrecognized escape sequence", { toml: str, ptr: i });
7056
+ sliceStart = i + 1;
7057
+ state = 0;
7058
+ }
7059
+ } else if (c !== " " && c !== "\t") {
7060
+ if (state === 2) {
7061
+ throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
7132
7062
  toml: str,
7133
- ptr: tmp
7063
+ ptr: sliceStart
7134
7064
  });
7135
7065
  }
7136
- sliceStart = ptr;
7137
- } else if (!isLiteral && c === "\\") {
7138
- tmp = ptr - 1;
7139
- isEscape = true;
7140
- parsed += str.slice(sliceStart, tmp);
7066
+ state = !isLiteral && c === "\\" ? 1 : 0;
7067
+ sliceStart = i;
7141
7068
  }
7142
7069
  }
7143
- return parsed + str.slice(sliceStart, endPtr - 1);
7070
+ throw new TomlError("unfinished string", { toml: str, ptr });
7144
7071
  }
7145
7072
  function parseValue(value, toml, ptr, integersAsBigInt) {
7146
7073
  if (value === "true")
@@ -7193,6 +7120,95 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
7193
7120
  return date;
7194
7121
  }
7195
7122
 
7123
+ // node_modules/smol-toml/dist/util.js
7124
+ /*!
7125
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
7126
+ * SPDX-License-Identifier: BSD-3-Clause
7127
+ *
7128
+ * Redistribution and use in source and binary forms, with or without
7129
+ * modification, are permitted provided that the following conditions are met:
7130
+ *
7131
+ * 1. Redistributions of source code must retain the above copyright notice, this
7132
+ * list of conditions and the following disclaimer.
7133
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
7134
+ * this list of conditions and the following disclaimer in the
7135
+ * documentation and/or other materials provided with the distribution.
7136
+ * 3. Neither the name of the copyright holder nor the names of its contributors
7137
+ * may be used to endorse or promote products derived from this software without
7138
+ * specific prior written permission.
7139
+ *
7140
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
7141
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
7142
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
7143
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
7144
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
7145
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
7146
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
7147
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
7148
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7149
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7150
+ */
7151
+ function indexOfNewline(str, start = 0, end = str.length) {
7152
+ let idx = str.indexOf(`
7153
+ `, start);
7154
+ if (str[idx - 1] === "\r")
7155
+ idx--;
7156
+ return idx <= end ? idx : -1;
7157
+ }
7158
+ function skipComment(str, ptr) {
7159
+ for (let i = ptr;i < str.length; i++) {
7160
+ let c = str[i];
7161
+ if (c === `
7162
+ `)
7163
+ return i;
7164
+ if (c === "\r" && str[i + 1] === `
7165
+ `)
7166
+ return i + 1;
7167
+ if (c < " " && c !== "\t" || c === "") {
7168
+ throw new TomlError("control characters are not allowed in comments", {
7169
+ toml: str,
7170
+ ptr
7171
+ });
7172
+ }
7173
+ }
7174
+ return str.length;
7175
+ }
7176
+ function skipVoid(str, ptr, banNewLines, banComments) {
7177
+ let c;
7178
+ while (true) {
7179
+ while ((c = str[ptr]) === " " || c === "\t" || !banNewLines && (c === `
7180
+ ` || c === "\r" && str[ptr + 1] === `
7181
+ `))
7182
+ ptr++;
7183
+ if (banComments || c !== "#")
7184
+ break;
7185
+ ptr = skipComment(str, ptr);
7186
+ }
7187
+ return ptr;
7188
+ }
7189
+ function skipUntil(str, ptr, sep2, end, banNewLines = false) {
7190
+ if (!end) {
7191
+ ptr = indexOfNewline(str, ptr);
7192
+ return ptr < 0 ? str.length : ptr;
7193
+ }
7194
+ for (let i = ptr;i < str.length; i++) {
7195
+ let c = str[i];
7196
+ if (c === "#") {
7197
+ i = indexOfNewline(str, i);
7198
+ } else if (c === sep2) {
7199
+ return i + 1;
7200
+ } else if (c === end || banNewLines && (c === `
7201
+ ` || c === "\r" && str[i + 1] === `
7202
+ `)) {
7203
+ return i;
7204
+ }
7205
+ }
7206
+ throw new TomlError("cannot find end of structure", {
7207
+ toml: str,
7208
+ ptr
7209
+ });
7210
+ }
7211
+
7196
7212
  // node_modules/smol-toml/dist/extract.js
7197
7213
  /*!
7198
7214
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -7253,25 +7269,24 @@ function extractValue(str, ptr, end, depth, integersAsBigInt) {
7253
7269
  }
7254
7270
  return [value, endPtr2];
7255
7271
  }
7256
- let endPtr;
7257
7272
  if (c === '"' || c === "'") {
7258
- endPtr = getStringEnd(str, ptr);
7259
- let parsed = parseString(str, ptr, endPtr);
7273
+ let [parsed, endPtr2] = parseString(str, ptr);
7260
7274
  if (end) {
7261
- endPtr = skipVoid(str, endPtr);
7262
- if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== `
7263
- ` && str[endPtr] !== "\r") {
7275
+ endPtr2 = skipVoid(str, endPtr2);
7276
+ if (str[endPtr2] && str[endPtr2] !== "," && str[endPtr2] !== end && str[endPtr2] !== `
7277
+ ` && str[endPtr2] !== "\r") {
7264
7278
  throw new TomlError("unexpected character encountered", {
7265
7279
  toml: str,
7266
- ptr: endPtr
7280
+ ptr: endPtr2
7267
7281
  });
7268
7282
  }
7269
- endPtr += +(str[endPtr] === ",");
7283
+ if (str[endPtr2] === ",")
7284
+ endPtr2++;
7270
7285
  }
7271
- return [parsed, endPtr];
7286
+ return [parsed, endPtr2];
7272
7287
  }
7273
- endPtr = skipUntil(str, ptr, ",", end);
7274
- let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","));
7288
+ let endPtr = skipUntil(str, ptr, ",", end);
7289
+ let slice = sliceAndTrimEndOf(str, ptr, endPtr - (str[endPtr - 1] === "," ? 1 : 0));
7275
7290
  if (!slice[0]) {
7276
7291
  throw new TomlError("incomplete key-value declaration: no value specified", {
7277
7292
  toml: str,
@@ -7280,7 +7295,8 @@ function extractValue(str, ptr, end, depth, integersAsBigInt) {
7280
7295
  }
7281
7296
  if (end && slice[1] > -1) {
7282
7297
  endPtr = skipVoid(str, ptr + slice[1]);
7283
- endPtr += +(str[endPtr] === ",");
7298
+ if (str[endPtr] === ",")
7299
+ endPtr++;
7284
7300
  }
7285
7301
  return [
7286
7302
  parseValue(slice[0], str, ptr, integersAsBigInt),
@@ -7337,13 +7353,7 @@ function parseKey(str, ptr, end = "=") {
7337
7353
  ptr
7338
7354
  });
7339
7355
  }
7340
- let eos = getStringEnd(str, ptr);
7341
- if (eos < 0) {
7342
- throw new TomlError("unfinished string encountered", {
7343
- toml: str,
7344
- ptr
7345
- });
7346
- }
7356
+ let [part, eos] = parseString(str, ptr);
7347
7357
  dot = str.indexOf(".", eos);
7348
7358
  let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
7349
7359
  let newLine = indexOfNewline(strEnd);
@@ -7368,7 +7378,7 @@ function parseKey(str, ptr, end = "=") {
7368
7378
  });
7369
7379
  }
7370
7380
  }
7371
- parsed.push(parseString(str, ptr, eos));
7381
+ parsed.push(part);
7372
7382
  } else {
7373
7383
  dot = str.indexOf(".", ptr);
7374
7384
  let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
@@ -7666,7 +7676,7 @@ function stringifyValue(val, type, depth, numberAsFloat) {
7666
7676
  return "inf";
7667
7677
  if (val === -Infinity)
7668
7678
  return "-inf";
7669
- if (numberAsFloat && Number.isInteger(val))
7679
+ if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
7670
7680
  return val.toFixed(1);
7671
7681
  return val.toString();
7672
7682
  }
@@ -8101,7 +8111,9 @@ class BunTestRunner {
8101
8111
  }
8102
8112
  }
8103
8113
  get registryPath() {
8104
- return path4.join(process.cwd(), ".stryker-bun-runner-registry.json");
8114
+ const key = `${process.cwd()}:${process.ppid}`;
8115
+ const hash = createHash("sha256").update(key).digest("hex").slice(0, 16);
8116
+ return path4.join(tmpdir(), "stryker-bun-runner", `registry-${hash}.json`);
8105
8117
  }
8106
8118
  get registryTmpPath() {
8107
8119
  return `${this.registryPath}.tmp`;
@@ -8496,6 +8508,7 @@ exit=%s timedOut=%s
8496
8508
  baseNameIndex: [...this.baseNameIndex.entries()],
8497
8509
  testNameIndex: [...testNameIndex.entries()]
8498
8510
  });
8511
+ await fsPromises2.mkdir(path4.dirname(registryPath), { recursive: true });
8499
8512
  await fsPromises2.writeFile(tmpPath, registryData, "utf8");
8500
8513
  this.lastRegistryTmpPath = tmpPath;
8501
8514
  await fsPromises2.rename(tmpPath, registryPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hughescr/stryker-bun-runner",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Stryker test runner plugin for Bun with perTest coverage support",
5
5
  "keywords": [
6
6
  "stryker",
@@ -43,24 +43,22 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@stryker-mutator/api": "9.6.1",
46
- "smol-toml": "1.6.1",
47
- "tinyglobby": "0.2.16",
48
- "ws": "8.20.0"
46
+ "smol-toml": "1.7.0",
47
+ "tinyglobby": "0.2.17",
48
+ "ws": "8.21.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@hughescr/eslint-config-default": "5.1.0",
51
+ "@hughescr/eslint-config-default": "6.0.1",
52
52
  "@stryker-mutator/core": "9.6.1",
53
53
  "@stryker-mutator/typescript-checker": "9.6.1",
54
- "@types/bun": "1.3.13",
55
- "@types/node": "25.6.0",
54
+ "@types/bun": "1.3.14",
55
+ "@types/node": "26.1.1",
56
56
  "@types/ws": "8.18.1",
57
57
  "dts-bundle-generator": "9.5.1",
58
- "eslint": "10.2.1",
58
+ "eslint": "10.7.0",
59
59
  "eslint-formatter-overview": "2.0.0",
60
60
  "eslint-formatter-unix": "9.0.1",
61
- "eslint-plugin-import-x": "4.16.2",
62
- "eslint-plugin-n": "17.24.0",
63
- "typescript": "6.0.3"
61
+ "typescript": "<7.0.0"
64
62
  },
65
63
  "peerDependencies": {
66
64
  "@stryker-mutator/core": "^9.0.0"