@hughescr/stryker-bun-runner 1.5.0 → 1.5.1

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
@@ -5,7 +5,7 @@ measures how good your tests are by making small changes (mutants) to your code
5
5
  some test fails for each one. This plugin lets Stryker run your `bun test` suite, using per-test
6
6
  coverage so that each mutant runs only the tests that reach it.
7
7
 
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.3.7-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)
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
11
  cheapest file first.
@@ -46,7 +46,7 @@ coverage so that each mutant runs only the tests that reach it.
46
46
 
47
47
  ### Before you start
48
48
 
49
- - **Bun 1.3.7 or later** (`bun --version`).
49
+ - **Bun 1.4.0 or later** (`bun --version`).
50
50
  - **Node.js 22 or later** (`node --version`). Stryker itself runs on Node; only your tests run on
51
51
  Bun. Stryker 10, which the install below gets you, needs Node 22; Stryker 9 needs Node 20.
52
52
  - **A project whose `bun test` passes**, with its source code under `src/` or `lib/` (Stryker's
@@ -104,9 +104,7 @@ bunx stryker run
104
104
  Abridged output from a small project with one test file (your counts will differ):
105
105
 
106
106
  ```text
107
- INFO BunTestRunner Bun test runner started: bun 1.4.2 at bun; 1 test file(s) from auto-discovery; sanitized bunfig /tmp/stryker-bun-runner-1000-0bfd2cdbbb207a22-0/stryker-bun-runner-bunfig-29463-1791682615998.toml; bail on
108
107
  INFO DryRunExecutor Starting initial test run (bun test runner with "perTest" coverage analysis). This may take a while.
109
- INFO BunTestRunner Bun test runner started: bun 1.4.2 at bun; 1 test file(s) from auto-discovery; sanitized bunfig /tmp/stryker-bun-runner-1000-0bfd2cdbbb207a22-0/stryker-bun-runner-bunfig-29462-1791682616021.toml; bail on
110
108
  INFO DryRunExecutor Initial test run succeeded. Ran 2 tests in 0 seconds (net 1 ms, overhead 90 ms).
111
109
  [Survived] EqualityOperator
112
110
  src/math.ts:6:12
@@ -124,8 +122,11 @@ INFO BunTestRunner Mutant runs on this worker: 3 (killed 2, survived 1, timeout
124
122
  INFO BunTestRunner Mutant runs on this worker: 4 (killed 4, survived 0, timeout 0, error 0); full-suite fallbacks: 0
125
123
  ```
126
124
 
127
- - Each Stryker **worker** process logs one `Bun test runner started` line, and one
128
- `Mutant runs on this worker` line at the end, so you see as many of each as Stryker has workers.
125
+ - Each Stryker **worker** process logs one `Mutant runs on this worker` line at the end, so you
126
+ see as many of them as Stryker has workers.
127
+ - Each worker process also logs one `Bun test runner started` line (bun version and path, test
128
+ files, sanitized bunfig), but at `debug`, so it only shows with `--logLevel debug`. These are
129
+ one per worker process, not one per dry run: the dry run itself happens once, on one worker.
129
130
  - **`Initial test run succeeded`** means the [dry run](#terms) passed: your whole suite ran once,
130
131
  unmutated, and the runner recorded which tests reach which mutants.
131
132
  - **Killed** mutants made a test fail: good. A **Survived** mutant is a change to your code that no
@@ -191,7 +192,7 @@ Most projects need no config change, but these differ from 1.4:
191
192
  `[test]` in it is kept (1.4 kept only `[install]`): [Your bunfig.toml](#your-bunfigtoml).
192
193
  - **Install.** A peer dependency on `typescript` below 7 (see the callout under
193
194
  [Install](#1-install)); dependencies are no longer bundled and install normally. Startup now
194
- requires Bun 1.3.7 or later and stops at once otherwise.
195
+ requires Bun 1.4.0 or later and stops at once otherwise.
195
196
  - **Test ids are unchanged**, so a 1.4 incremental report stays reusable. The one exception is a
196
197
  test retried in the dry run (a per-test `{ retry }` option, or `retry` in your bunfig): it had one
197
198
  id per attempt (`name [0]`, `name [1]`, ...) and now has the single id `name`.
@@ -230,7 +231,7 @@ Most projects need no config change, but these differ from 1.4:
230
231
 
231
232
  | Component | Supported | Notes |
232
233
  |---|---|---|
233
- | Bun | 1.3.7 or later | Tested with 1.3.7, 1.3.14 and 1.4.2. Older versions lack the inspector test events the runner needs ([oven-sh/bun#25986](https://github.com/oven-sh/bun/pull/25986)). |
234
+ | Bun | 1.4.0 or later | Tested with 1.4.0, 1.4.2 and 1.4.3. 1.4.0 is the oldest release the runner's test suite is run against, so older versions are not supported. |
234
235
  | `@stryker-mutator/core` | 9.x or 10.x | Peer dependency. Stryker's `testFiles` option needs 9.6 or later. |
235
236
  | Node.js | 20 or later with Stryker 9; 22 or later with Stryker 10 | Stryker runs on Node; only the test processes run on Bun. |
236
237
  | `typescript` | 6 or earlier, when your project has a `tsconfig.json` | Peer dependency (`<7`): bun warns and npm refuses to install next to TypeScript 7, and a project without TypeScript gets TypeScript 6. Stryker reads `tsconfig.json` with it, with or without a checker, and TypeScript 7's package cannot (see [Install](#1-install)). TypeScript 7 can only be added next to it, for the [native checker](#typescript-7s-native-checker-experimental). |
@@ -238,7 +239,7 @@ Most projects need no config change, but these differ from 1.4:
238
239
  | Operating system | Linux, macOS | |
239
240
 
240
241
  At startup the runner runs `<bunPath> --version` and stops with a clear error if Bun cannot be run
241
- or is older than 1.3.7. To upgrade Bun, run `bun upgrade`.
242
+ or is older than 1.4.0. To upgrade Bun, run `bun upgrade`.
242
243
 
243
244
  ## Configuration
244
245
 
@@ -547,8 +548,8 @@ Every log message: [Log output](docs/internals.md#log-output).
547
548
  | `TypeError: ts.parseConfigFileTextToJson is not a function` (from Stryker) | TypeScript 7 is installed as `typescript`. | `bun remove typescript && bun add -D typescript@^6` (see [Install](#1-install)). |
548
549
  | `Cannot find TestRunner plugin "bun"` (from Stryker) | The plugin was not loaded. | Add `appendPlugins: ['@hughescr/stryker-bun-runner']`. |
549
550
  | `Config option "bun" must NOT have additional properties` (from Stryker) | A misspelt or unknown option under `bun`. Stryker does not say which. | Compare each key under `bun` with the [options table](#configuration). |
550
- | `stryker-bun-runner: could not run "<bunPath>" (<reason>). Install bun >= 1.3.7 or set bun.bunPath in your Stryker config.` | Bun is not installed, not on `PATH`, or `bun.bunPath` is wrong. | Install Bun or set `bun.bunPath`. `bun.env` can set `PATH`. |
551
- | `stryker-bun-runner: bun <version> at "<bunPath>" is too old; version 1.3.7 or newer is required.` | Bun before 1.3.7 lacks the inspector events the runner needs. | `bun upgrade`. |
551
+ | `stryker-bun-runner: could not run "<bunPath>" (<reason>). Install bun >= 1.4.0 or set bun.bunPath in your Stryker config.` | Bun is not installed, not on `PATH`, or `bun.bunPath` is wrong. | Install Bun or set `bun.bunPath`. `bun.env` can set `PATH`. |
552
+ | `stryker-bun-runner: bun <version> at "<bunPath>" is too old; version 1.4.0 or newer is required.` | Bun before 1.4.0, which the runner does not support. | `bun upgrade`. |
552
553
  | `stryker-bun-runner: bun.bunArgs contains "<flag>", which <reason>. Remove it.` (or `contains unsupported flags`) | A flag that would corrupt the scores. | Remove it; see [bun.bunArgs](#bunbunargs). |
553
554
  | `has no usable path: write --config=<path>, --config <path> or -c <path>` | A `--config`/`-c` with no file name. | Give the path. |
554
555
  | `Failed to read bunfig.toml at <path>` or `Failed to read bunfig (named by --config in bun.bunArgs) at <path>` | The bunfig does not parse, or the file named by `--config` is not in the sandbox. | Fix the file, or the path and `ignorePatterns`. |
package/dist/index.d.ts CHANGED
@@ -250,10 +250,11 @@ export declare class BunTestRunner implements TestRunner {
250
250
  /** Debug-log how many test files the dry run uses and where they came from. Same precedence as {@link getOrDiscoverTestFiles}. */
251
251
  private logTestFilesSource;
252
252
  /**
253
- * Log the one-line start summary (at info, once per runner): the bun version and path, how
253
+ * Log the one-line start summary (at debug, once per runner): the bun version and path, how
254
254
  * many test files the runner hands bun and where they came from, the sanitized bunfig, and
255
255
  * whether mutant runs bail. Called at the end of init(), so a re-init in another cwd
256
- * (Stryker's sandbox rotation) does not repeat it.
256
+ * (Stryker's sandbox rotation) does not repeat it. It is debug, not info, because every
257
+ * Stryker worker process logs its own copy, which at high concurrency reads like many dry runs.
257
258
  *
258
259
  * @param testFiles the files {@link getOrDiscoverTestFiles} chose; undefined when discovery
259
260
  * found none and bun is left to discover the tests itself
package/dist/index.js CHANGED
@@ -1812,7 +1812,7 @@ function assertSupportedBunArgs(bunArgs) {
1812
1812
  }
1813
1813
  // src/utils/bun-version.ts
1814
1814
  import { spawn as spawn3 } from "node:child_process";
1815
- var MIN_BUN_VERSION = "1.3.7";
1815
+ var MIN_BUN_VERSION = "1.4.0";
1816
1816
  var VERSION_CHECK_TIMEOUT_MS = 1e4;
1817
1817
  function parseBunVersion(output) {
1818
1818
  const match = /(\d{1,9})\.(\d{1,9})\.(\d{1,9})/.exec(output);
@@ -2704,7 +2704,7 @@ class BunTestRunner {
2704
2704
  if (this.disableBail !== undefined) {
2705
2705
  parts.push(this.disableBail ? "bail off" : "bail on");
2706
2706
  }
2707
- this.logger.info("%s", parts.join("; "));
2707
+ this.logger.debug("%s", parts.join("; "));
2708
2708
  }
2709
2709
  warnIfTestFilesOverridden(selected, cwd) {
2710
2710
  if (this.warnedTestFilesConflict || this.testFilesOverride === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hughescr/stryker-bun-runner",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Stryker mutation testing test runner plugin for Bun (bun test), with per-test coverage",
5
5
  "keywords": [
6
6
  "stryker",
@@ -68,7 +68,7 @@
68
68
  "typescript": "<7"
69
69
  },
70
70
  "engines": {
71
- "bun": ">=1.3.7",
71
+ "bun": ">=1.4.0",
72
72
  "node": ">=20"
73
73
  },
74
74
  "patchedDependencies": {