@hughescr/stryker-bun-runner 1.5.1 → 1.6.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/README.md CHANGED
@@ -8,7 +8,7 @@ coverage so that each mutant runs only the tests that reach it.
8
8
  [![npm version](https://img.shields.io/npm/v/@hughescr/stryker-bun-runner)](https://www.npmjs.com/package/@hughescr/stryker-bun-runner) [![LICENSE](https://img.shields.io/badge/LICENSE-Apache--2.0-blue)](LICENSE.md) [![Bun](https://img.shields.io/badge/Bun-%3E%3D1.4.0-f9f1e1?logo=bun)](https://bun.sh) [![Stryker](https://img.shields.io/badge/Stryker-9%20%7C%2010-e74c3c?logo=stryker)](https://stryker-mutator.io) [![Mutation testing badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fhughescr%2Fstryker-bun-runner%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/hughescr/stryker-bun-runner/main)
9
9
 
10
10
  - **Per-test coverage**, so each mutant runs only its covering tests, in only their files,
11
- cheapest file first.
11
+ cheapest file first; a static mutant's whole-suite run starts with the files likeliest to kill it.
12
12
  - **Honest scoring**: a crash or a run that proves nothing is an Error, not a kill; a test file
13
13
  that a mutant stops from loading is a kill; an infinite loop is stopped early and scored Timeout.
14
14
  - **A strict dry run** that fails loudly rather than hand Stryker incomplete coverage.
@@ -21,6 +21,7 @@ coverage so that each mutant runs only the tests that reach it.
21
21
  - [Before you start](#before-you-start) · [Install](#1-install) · [Configure](#2-configure) ·
22
22
  [Run](#3-run) · [Reading the output](#reading-the-output) ·
23
23
  [Optional: skip mutants that do not compile](#optional-skip-mutants-that-do-not-compile)
24
+ - [Upgrading from 1.5](#upgrading-from-15)
24
25
  - [Upgrading from 1.4](#upgrading-from-14)
25
26
  - [Terms](#terms)
26
27
  - [Requirements and compatibility](#requirements-and-compatibility)
@@ -163,8 +164,38 @@ export default await withTestFilesExcludedFromTypeCheck({
163
164
  });
164
165
  ```
165
166
 
167
+ ## Upgrading from 1.5
168
+
169
+ Most projects need no config change, but these differ from 1.5:
170
+
171
+ - **Faster.** On the repo's benchmark fixture (remeda, 1766 mutants, 4 workers, `coverageAnalysis:
172
+ 'perTest'`) a full run takes about 37% less wall time than 1.5.2, with no change in which
173
+ mutants are caught. The main reasons: a much cheaper parent-death watch in every `bun test`
174
+ child; static mutants run their likeliest killing test files first; mutant runs ask bun to print
175
+ only failing tests; and a cheaper dry run on large suites. [bench/README.md](bench/README.md)
176
+ explains how it is measured.
177
+ - **Some verdicts change, toward correctness** ([How results are scored](#how-results-are-scored)).
178
+ A mutant that makes a test, hook or module call `process.exit(0)` before bun prints its summary
179
+ is Error, not Survived (Killed when a failing test was reported first). With `FORCE_COLOR` set,
180
+ failing tests are now read, so `killedBy` is filled in and some Error verdicts become Killed. A
181
+ Killed mutant's reason is now the error bun printed for the test; before, it was often unrelated
182
+ lines. Incremental mode keeps the old verdict of mutants it reuses; run once with `--force` to
183
+ re-score.
184
+ - **Mutant-run file order.** Static mutants (and other planned full-suite runs) run the test
185
+ files most likely to kill them first, judged from the dry run's coverage, then cheapest first.
186
+ The order can differ between mutants, so the runner assumes an order-independent suite
187
+ ([Mutant runs](docs/internals.md#mutant-runs)).
188
+ - **Temporary files.** Each run's private temp directory is now removed when the Stryker run
189
+ ends, and the directories of runs that died are swept by later runs after an hour. The
190
+ directory names changed. Directories left by older versions are safe to delete by hand
191
+ ([Temporary files](docs/internals.md#temporary-files)).
192
+ - **Profiling.** The new opt-in `STRYKER_BUN_PROFILE=/abs/path.jsonl` writes a per-run phase
193
+ timing profile ([Profiling a run](CONTRIBUTING.md#profiling-a-run)).
194
+
166
195
  ## Upgrading from 1.4
167
196
 
197
+ Coming from 1.4, also read [Upgrading from 1.5](#upgrading-from-15) for what changed since.
198
+
168
199
  Most projects need no config change, but these differ from 1.4:
169
200
 
170
201
  - **`bun.timeout` now bounds only the dry run** (plus the 30 s drain-handshake allowance). Mutant
@@ -173,13 +204,14 @@ Most projects need no config change, but these differ from 1.4:
173
204
  small margin ([Timeouts](#timeouts)). If you raised `bun.timeout` so slow mutant runs would not
174
205
  time out, raise `timeoutMS` or `timeoutFactor` instead. `bun.timeout` can now be generous: the
175
206
  runner warns above 80% use, and only a hung dry run takes that long to fail.
176
- - **Mutant runs never randomize.** Covering files run cheapest first (by dry-run time), tests in
177
- source order. The dry run still follows your bunfig `randomize` and `seed`.
207
+ - **Mutant runs never randomize.** Files run cheapest first (by dry-run time; a static mutant's
208
+ likeliest killers before that), tests in source order. The dry run still follows your bunfig `randomize` and `seed`.
178
209
  - **Some verdicts change, toward correctness** ([How results are scored](#how-results-are-scored)).
179
210
  A hang that a fast test catches is Killed. An infinite loop stops at Stryker's hit limit and is
180
211
  Timeout, reason `Hit limit reached`. A bun crash or failed start with no failing test is Error
181
212
  (left out of the score), not Killed. A mutant that stops a test file loading is Killed (1.4
182
- usually scored it Error). Incremental mode keeps the old verdict of mutants it reuses; run once
213
+ usually scored it Error). A mutant that makes a test, hook or module call `process.exit(0)` is
214
+ Error, not Survived. Incremental mode keeps the old verdict of mutants it reuses; run once
183
215
  with `--force` to re-score.
184
216
  - **The dry run is stricter.** Bun's summary, the inspector's events and the coverage records must
185
217
  agree exactly (1.4 tolerated small shortfalls), and missing per-test coverage with
@@ -330,10 +362,11 @@ the runner warns once when it finds any. Details, including the command-line len
330
362
 
331
363
  `bun test --config` replaces your bunfig rather than adding to it, so the runner hands bun a
332
364
  sanitized copy of yours. Everything outside `[test]` is kept. In `[test]`, `preload`, `root`,
333
- `pathIgnorePatterns`, `timeout`, `smol`, `randomize` and `seed` are kept; `coverage` and
334
- `onlyFailures` are forced off; `retry` and `rerunEach` are dropped with a warning; anything else is
335
- dropped. Mutant runs never randomize the test order. Your `[test].preload` files run before the
336
- runner's own [preload](#terms). Details:
365
+ `pathIgnorePatterns`, `timeout`, `smol`, `randomize` and `seed` are kept; `coverage` is forced
366
+ off, and `onlyFailures` is forced off for the dry run; `retry` and `rerunEach` are dropped with a
367
+ warning; anything else is dropped. Mutant runs never randomize the test order, and in them bun
368
+ lists only failing tests. Your `[test].preload` files run before the runner's own
369
+ [preload](#terms). Details:
337
370
  [the sanitized config](docs/internals.md#your-bunfigtoml-the-sanitized-config).
338
371
 
339
372
  ## How it works
@@ -356,12 +389,14 @@ More: [Mutant runs](docs/internals.md#mutant-runs), [the dry run in detail](docs
356
389
 
357
390
  - **Killed** when a test fails, or when a test file fails to load because of the mutant (bun reports
358
391
  a failure count but no failing test).
359
- - **Survived** when every selected test passes.
392
+ - **Survived** when every selected test passes and bun finishes the run (prints its summary).
360
393
  - **Timeout** when the hit limit is exceeded, the time limit is reached, or `bun.maxChildRss` is
361
394
  exceeded.
362
395
  - **Error** when the run proves nothing either way: the process crashed with no failing test that
363
396
  matches a known test, could not be started, exited with an error but no failing test and no failure
364
- count, or a full-suite fallback ran out of the time Stryker sized for the covering tests.
397
+ count, exited 0 before running every selected test (a test, hook or module called
398
+ `process.exit(0)`) with no failing test that matches a known test, or a full-suite fallback ran out of the time Stryker sized
399
+ for the covering tests. An early exit is never Survived: the tests after it never ran.
365
400
 
366
401
  The full table and the reasoning: [How results are scored](docs/internals.md#how-results-are-scored).
367
402
 
@@ -597,6 +632,7 @@ also fails; see [Inspector diagnostics](docs/internals.md#inspector-diagnostics)
597
632
  | `Mutant <id>: bun test terminated by <SIGNAL>` ... `scoring as Error rather than Killed` | The process crashed (SIGSEGV, an out-of-memory kill) without a failing test. | A few can be a real crash in your suite; many mean memory pressure: lower `concurrency`, set `bun.maxChildRss`. |
598
633
  | `Mutant <id>: could not start bun test: <error>` | Bun could not be started. | Check `bun.bunPath`, `PATH` and system limits. |
599
634
  | `Mutant <id>: bun test exited with code <N> but reported no failing test and no fail/error count` | Bun failed before running tests (a missing preload, an unreadable bunfig). | Read the output in the warning. |
635
+ | `Mutant <id>: bun exited 0 before running every selected test` ... `scoring as Error rather than Survived` | The mutant made a test, hook or module call `process.exit(0)`, so bun stopped without its summary. | Usually nothing: the mutant changed behaviour. If many mutants do this, look for a `process.exit` in the code under test. |
600
636
  | `Mutant <id>: inconclusive timeout, scoring as Error rather than Timeout` | A full-suite fallback did not finish within the time Stryker sized for the covering tests. | Raise Stryker's `timeoutMS` or `timeoutFactor`. |
601
637
  | `Mutant <id>: --test-name-pattern matched 0 tests` | The mutant changed a test's name (often an interpolated `it.each` title); the runner retries with the full suite. | Usually nothing; spot-check that the mutant changes a title. |
602
638
  | `no exact-name registry available` or `missing from exact-name registry` | A worker could not match test ids to bun's exact names; tests whose titles contain ` > ` may have been skipped in that run. | Check for an earlier registry warning; re-run. |
@@ -604,7 +640,7 @@ also fails; see [Inspector diagnostics](docs/internals.md#inspector-diagnostics)
604
640
  | `bun test child exceeded maxChildRss` | A run went over `bun.maxChildRss`; scored Timeout. | Expected for runaway mutants; raise the limit if many hit it. |
605
641
  | Many mutants Timeout | Stryker's timeout is tight for your suite, or many mutants loop forever. Infinite loops stopped by the hit limit carry the reason `Hit limit reached (count/limit)`: open the mutant in the HTML report, or read `statusReason` in Stryker's JSON report. | For the others, raise `timeoutMS` or `timeoutFactor`. |
606
642
  | Every mutant runs the whole suite | No per-test coverage: `coverageAnalysis` is not `'perTest'`, or coverage was missing. | Use `'perTest'` and check the dry-run warnings. |
607
- | The score changed after upgrading this plugin | Scoring has changed over time (for example, a crash without a matching failing test is now Error, and a test file that a mutant stops from loading is Killed). | Expected. See [Upgrading from 1.4](#upgrading-from-14), [How results are scored](#how-results-are-scored), and the [commit history](https://github.com/hughescr/stryker-bun-runner/commits/main) for what changed. |
643
+ | The score changed after upgrading this plugin | Scoring has changed over time (for example, a crash without a matching failing test is now Error, and a test file that a mutant stops from loading is Killed). | Expected. See [Upgrading from 1.5](#upgrading-from-15), [Upgrading from 1.4](#upgrading-from-14), [How results are scored](#how-results-are-scored), and the [commit history](https://github.com/hughescr/stryker-bun-runner/commits/main) for what changed. |
608
644
 
609
645
  ## Limitations
610
646
 
@@ -626,13 +662,14 @@ also fails; see [Inspector diagnostics](docs/internals.md#inspector-diagnostics)
626
662
 
627
663
  [docs/internals.md](docs/internals.md) covers how the runner works in detail:
628
664
 
629
- - [Mutant runs](docs/internals.md#mutant-runs): test selection, cheapest-first ordering, fallbacks
665
+ - [Mutant runs](docs/internals.md#mutant-runs): test selection, test-file ordering, fallbacks
630
666
  - [How results are scored](docs/internals.md#how-results-are-scored) and
631
667
  [the hit limit](docs/internals.md#infinite-loops-the-hit-limit)
632
668
  - [The dry run in detail](docs/internals.md#the-dry-run-in-detail): the start and drain handshakes,
633
669
  the completeness gate, coverage checks
634
670
  - [Log output](docs/internals.md#log-output): start and end summaries, repeated warnings
635
- - [Temporary files](docs/internals.md#temporary-files): the private per-run directory
671
+ - [Temporary files](docs/internals.md#temporary-files): the private per-run directory, removed when
672
+ the run ends
636
673
  - [Child processes](docs/internals.md#child-processes): process groups, orphan prevention,
637
674
  recursion containment
638
675
  - [Memory](docs/internals.md#memory) and
package/dist/index.d.ts CHANGED
@@ -25,8 +25,9 @@ export declare class BunTestRunner implements TestRunner {
25
25
  /** {@link bunArgs} for mutant runs: without `--randomize`/`--seed`, which only the dry run keeps (see stripRandomizeArgs). */
26
26
  private readonly mutantBunArgs?;
27
27
  /**
28
- * True when the current sanitized bunfig randomizes the test order, so mutant runs use its mutant-run
29
- * copy (see mutantRunBunfigPath). Set whenever the sanitized bunfig is (re)generated, which every run does first.
28
+ * True when the current sanitized bunfig randomizes the test order, which its mutant-run copy (see
29
+ * mutantRunBunfigPath) turns off; only logged (see logRandomizeOffOnce). Set whenever the sanitized bunfig is
30
+ * (re)generated, which every run does first.
30
31
  */
31
32
  private sanitizedBunfigRandomizes?;
32
33
  /** True once the "randomized order is off for mutant runs" debug line has been logged; it is shown once per runner. */
@@ -39,6 +40,19 @@ export declare class BunTestRunner implements TestRunner {
39
40
  * ascending order of it; undefined when neither had any, and the order is then left alone.
40
41
  */
41
42
  private testFileDurations?;
43
+ /**
44
+ * Which test files' tests executed which mutants in the dry run, from this worker's dry
45
+ * run or the shared registry; undefined when neither had any. Ranks a static mutant's
46
+ * files likely killers first (see orderForMutantRun).
47
+ */
48
+ private testFileCoverage?;
49
+ /**
50
+ * Per instrumented source file (MutantRunOptions.sandboxFileName), per test file, how
51
+ * many of its mutants the test file's tests executed in the dry run. Derived from
52
+ * {@link testFileCoverage} and the file's mutant switches on a static run's first need;
53
+ * cleared when that changes.
54
+ */
55
+ private readonly sourceCoverageCounts;
42
56
  /** The user's bunfig named by `--config`/`-c` in `bun.bunArgs`, as written: the source the runner sanitizes and reads `[test].root` from. */
43
57
  private readonly sourceBunfig?;
44
58
  private readonly testFilesOverride?;
@@ -54,6 +68,10 @@ export declare class BunTestRunner implements TestRunner {
54
68
  private sanitizedBunfigPath?;
55
69
  private sanitizedBunfigCwd?;
56
70
  private tempDir?;
71
+ /** When this worker last marked tempDir in use (see keepRunTempDirFresh). */
72
+ private tempDirTouchedAt;
73
+ /** process.ppid at the first init(): the Stryker main process that owns the run (see assertRunOwnerIsParent). */
74
+ private runOwnerPid?;
57
75
  private cachedTestNames?;
58
76
  private baseNameIndex?;
59
77
  private testNameIndex?;
@@ -96,6 +114,8 @@ export declare class BunTestRunner implements TestRunner {
96
114
  private mutantRunsByStatus;
97
115
  /** Mutant runs that had covering tests but ran the full suite anyway (pattern too long, or zero-match retry). Reset with {@link mutantRunsByStatus}. */
98
116
  private fullSuiteFallbacks;
117
+ /** Times every run when STRYKER_BUN_PROFILE names a file; undefined otherwise (see src/run-profile.ts). */
118
+ private readonly profiler?;
99
119
  /**
100
120
  * AbortController for whichever `dryRun`/`mutantRun` child process is
101
121
  * currently in flight, if any. Lets {@link dispose} kill an orphaned child
@@ -108,16 +128,17 @@ export declare class BunTestRunner implements TestRunner {
108
128
  * Single source of truth for the registry file name.
109
129
  *
110
130
  * Lives in the OS temp directory, not cwd: under Stryker's --inPlace mode
111
- * cwd IS the user's real project root, and writing there would both
112
- * pollute the user's project and never get cleaned up (dispose()
113
- * deliberately never unlinks the registry itself — see its doc comment).
114
- * The temp directory is OS-managed instead. Specifically it is the run's
131
+ * cwd IS the user's real project root, and writing there would pollute
132
+ * the user's project. No worker removes it (dispose() deliberately never
133
+ * unlinks the registry itself — see its doc comment); the run's Stryker
134
+ * main process removes the whole directory when it exits
135
+ * (removeRunTempDirsOnExit). Specifically it is the run's
115
136
  * private directory (src/utils/private-temp-dir.ts): owned by the current
116
137
  * user, mode 0700, re-resolved (and so re-verified) before every write and
117
138
  * before the lazy load, so another local user can neither plant nor read a
118
139
  * registry.
119
140
  *
120
- * Keyed by sha256(cwd + ':' + ppid) (plus the uid, in the directory name): every worker process Stryker spawns
141
+ * Keyed by sha256(cwd + ':' + ppid) (plus the uid, the pid space and the ppid, in the directory name): every worker process Stryker spawns
121
142
  * for one run is a direct child of that run's single Stryker main
122
143
  * process, so all of them share BOTH process.cwd() (the sandbox
123
144
  * directory) AND process.ppid (the main process's pid) — and therefore
@@ -156,15 +177,34 @@ export declare class BunTestRunner implements TestRunner {
156
177
  */
157
178
  private resolveRegistryPath;
158
179
  /**
180
+ * Refuse to resolve (and so create) the run directory once this worker's parent
181
+ * has changed since init(): the Stryker main process that owned the run has
182
+ * exited, and has removed the directory or will, and this worker has been
183
+ * reparented. Stryker's signal path exits without disposing the workers, so one
184
+ * can still be finishing a run. Under its new parent it would derive, and
185
+ * create, a directory named for a process that never ran Stryker, which no
186
+ * cleanup would ever judge finished.
187
+ */
188
+ private assertRunOwnerIsParent;
189
+ /**
190
+ * Mark the run directory in use at most every RUN_DIR_TOUCH_INTERVAL_MS, so a
191
+ * live run's directory never looks abandoned to another process's cleanup
192
+ * (see STALE_RUN_DIR_AGE_MS in src/utils/private-temp-dir.ts). One syscall
193
+ * every few minutes; skipped once this worker is orphaned.
194
+ */
195
+ private keepRunTempDirFresh;
196
+ /**
159
197
  * Narrow a targeted mutant run to just the test FILES its covering tests live
160
198
  * in.
161
199
  *
162
200
  * `--test-name-pattern` filters at the TEST level, not the file level: bun
163
201
  * still loads every test file it was given in order to discover which names
164
- * match. On a suite of 31 spec files that costs ~330ms per run of which only
165
- * ~54ms is process startup — and a run that ends up executing two tests pays
166
- * it in full, on every mutant. Handing bun only the files that can contain a
167
- * covering test drops the same measurement to ~66ms.
202
+ * match, and a run that ends up executing two tests pays that in full, on
203
+ * every mutant. Measured on bun 1.4.2 (4-CPU Linux, the benchmark fixture's
204
+ * 160 instrumented test files), a run selecting two tests takes ~180ms when
205
+ * handed every file and ~18ms when handed only the covering file. Of those
206
+ * ~18ms, ~15ms is the child's startup through the coverage preload (bun itself
207
+ * ~2ms, `bun test`'s own setup ~6ms, our argv and preload ~6ms).
168
208
  *
169
209
  * Test ids are `<projectFile> > <fullName>` (see buildProjectFileTestName), so
170
210
  * the file is already the id's prefix and no extra bookkeeping is needed.
@@ -194,6 +234,43 @@ export declare class BunTestRunner implements TestRunner {
194
234
  * all — go last in their old order. `files` itself is not modified.
195
235
  */
196
236
  private orderCheapestFirst;
237
+ /** Each of `files` mapped to its project-relative path, normalized once, for the orderings of one mutant run to share. */
238
+ private projectFilesOf;
239
+ /**
240
+ * True when a mutant run hands bun its files likely killers first (see
241
+ * orderForMutantRun) rather than cheapest first: a planned full-suite run (no
242
+ * covering test ids: a static mutant, a mutant with no coverage, or a run scoped
243
+ * to Stryker's testFiles) that bails.
244
+ *
245
+ * - Without bail every file runs whatever the order, so reordering saves nothing.
246
+ * - A targeted run's files all executed the mutant; its first file usually kills
247
+ * it already (measured: under 3% of killed targeted mutants on the benchmark
248
+ * fixture needed a second file), so it stays cheapest first.
249
+ * - A full-suite fallback (covering tests, but the pattern was too long or matched
250
+ * nothing) runs against a deadline Stryker sized for those covering tests only.
251
+ * Moving a slower file ahead of the killer there could turn a kill into the
252
+ * inconclusive-timeout Error, so it stays cheapest first.
253
+ */
254
+ private ordersLikelyKillersFirst;
255
+ /**
256
+ * `files` in the order a mutant run hands them to bun: cheapest first (see
257
+ * orderCheapestFirst), then, when {@link ordersLikelyKillersFirst} says so, with
258
+ * the files likeliest to kill this mutant moved to the front, ranked by dry-run
259
+ * coverage of the mutant and of its source file, and by a name match (see
260
+ * likely-killer-order.ts). Files that rank the same keep their cheapest-first
261
+ * order, so with no signal at all the order is cheapest first.
262
+ */
263
+ private orderForMutantRun;
264
+ /** Replace the dry-run per-file mutant coverage, and drop everything derived from the old one. */
265
+ private setTestFileCoverage;
266
+ /**
267
+ * Per test file, how many mutants of the instrumented source file `sandboxFileName`
268
+ * its tests executed in the dry run, or undefined without dry-run coverage. The
269
+ * file's mutants are read from its mutant switches (see
270
+ * mutantIdsInInstrumentedSource) once per worker; a file that cannot be read
271
+ * counts as having none, which only leaves that rank unused.
272
+ */
273
+ private sourceCoverageFor;
197
274
  /**
198
275
  * Say once, at debug, that mutant runs do not randomize the test order although
199
276
  * the project asked for it (in the bunfig, in bun.bunArgs, or both). They run
@@ -368,6 +445,8 @@ export declare class BunTestRunner implements TestRunner {
368
445
  * not `options.timeout` (dryRunTimeoutMinutes), bounds the child.
369
446
  */
370
447
  dryRun(options?: DryRunOptions): Promise<DryRunResult>;
448
+ /** The dry run itself; split from {@link dryRun} so its many returns all reach the profile. */
449
+ private executeDryRun;
371
450
  /**
372
451
  * The dry run's coverageAnalysis: Stryker's DryRunOptions value, else the
373
452
  * Stryker options' value. Extracted to keep dryRun()'s complexity under the
@@ -561,6 +640,36 @@ export declare class BunTestRunner implements TestRunner {
561
640
  */
562
641
  private classifyRunWithoutFailedTest;
563
642
  /**
643
+ * Classify a mutant run that exited 0 without bun's summary.
644
+ *
645
+ * Bun prints its summary (` N pass` … `Ran N tests across M files`) only once
646
+ * every file has run, on every run that gets that far: with every reporter,
647
+ * `onlyFailures`, `--dots`, junit, the AI-agent reporter, and a `-t` pattern
648
+ * (verified on bun 1.4.2). So an exit with code 0 and no summary means the
649
+ * process left early: a test, a hook or a module at load called
650
+ * `process.exit(0)` (bun 1.4.2 then prints nothing more, not even the
651
+ * summary of the tests that already passed), and every selected test after
652
+ * that point never ran. The mutant changed what the suite does, so the run
653
+ * is never Survived. It is scored as the other early terminations are
654
+ * (a non-zero exit with no failing test, a signal death): Killed when a
655
+ * failing test that matches a known test was reported before the exit
656
+ * (without bail, bun still exits 0 after one), and otherwise Error, since
657
+ * no test is known to have failed.
658
+ *
659
+ * The signal is the summary's absence, not its count: a `-t` pattern counts
660
+ * only the tests it matched (a partial miss is legitimate), and skipped,
661
+ * pending, retried and `.only`-filtered tests change the count on healthy
662
+ * runs, so a count lower than the selected tests proves nothing.
663
+ */
664
+ private classifyEarlyCleanExit;
665
+ /**
666
+ * Error result for a run that exited 0 before bun's summary with no
667
+ * attributable failing test — see classifyEarlyCleanExit. It quotes the END
668
+ * of the output (stdout, then stderr), which shows where the exit happened;
669
+ * with passing tests hidden, the start is usually just a file header.
670
+ */
671
+ private buildEarlyExitErrorResult;
672
+ /**
564
673
  * Check for dry run process failures (timeout or non-zero exit).
565
674
  * Returns a DryRunResult to short-circuit if the process failed, or null to proceed.
566
675
  */
@@ -704,15 +813,23 @@ export declare class BunTestRunner implements TestRunner {
704
813
  */
705
814
  private logMutantRunSummary;
706
815
  /**
707
- * Cleanup resources
708
- *
709
- * Removes only this worker's own files. The registry, and so the run's private
710
- * temp directory holding it, is deliberately left in place: Stryker gives a
711
- * worker no signal that it is the last one, and maxTestRunnerReuse /
712
- * crash recovery dispose a worker mid-run and start a fresh process that must
713
- * still find the registry (with concurrency 1, the disposing worker IS the
714
- * only one, so a "last one out" check would delete it from under its successor).
715
- */
816
+ * Append the worker's profile summary, if profiling. Profiling is diagnostic
817
+ * only: a summary that throws is warned about, never allowed to stop
818
+ * dispose() from stopping the child and cleaning up.
819
+ */
820
+ private writeProfileSummary;
821
+ /**
822
+ * Cleanup resources
823
+ *
824
+ * Removes only this worker's own files. The registry, and so the run's private
825
+ * temp directory holding it, is deliberately left in place: Stryker gives a
826
+ * worker no signal that it is the last one, and maxTestRunnerReuse, timeouts
827
+ * and crash recovery dispose (and kill) a worker before forking the fresh
828
+ * process that replaces it, which must still find the registry (with
829
+ * concurrency 1 no worker is alive in between, so a "last one out" check would
830
+ * delete it from under its successor). The run's Stryker main process removes
831
+ * the directory when it exits (removeRunTempDirsOnExit, src/index.ts).
832
+ */
716
833
  dispose(): Promise<void>;
717
834
  }
718
835
  /** Options for {@link withTestFilesExcludedFromTypeCheck}. */