@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.
@@ -105,13 +105,38 @@ const perFileCounters = new Map<string, number>();
105
105
 
106
106
  // Helper: extract a stable relative file prefix from a Bun.main absolute path.
107
107
  // Strips the Stryker sandbox prefix so keys are portable across runs.
108
+ //
109
+ // Under `inPlace: true` there IS no sandbox segment to strip, and the old
110
+ // fallback here collapsed the path to its basename. That is not a portable
111
+ // prefix, it is an unmatchable one: Stryker resolves a test's fileName against
112
+ // its input files, so `example.spec.ts` became `<projectRoot>/example.spec.ts`
113
+ // matched nothing. Three symptoms followed from that one line — "Test file … not
114
+ // found in input files" warnings, spurious "Interior coverage gap detected"
115
+ // warnings (the prefix is compared for equality against the inspector's
116
+ // normalised URL), and an incremental report whose differ saw every test as
117
+ // changed (+N -N) and so reused almost nothing.
118
+ //
119
+ // Falling back to the path relative to cwd fixes all three: monorepo task
120
+ // runners invoke per-project builds with cwd set to the project root, which is
121
+ // exactly what Stryker keys its input files on. Kept in lockstep with
122
+ // normalizeTestFilePath, which must produce the same string for the equality
123
+ // check above to hold.
108
124
  function extractFilePrefix(bunMain: string): string {
109
125
  if(!bunMain) {
110
126
  return 'unknown';
111
127
  }
112
128
  // Stryker disable next-line Regex: sandbox path extraction pattern
113
129
  const sandboxMatch = /\.stryker-tmp\/sandbox-[^/]+\/(.+)$/.exec(bunMain);
114
- return sandboxMatch ? sandboxMatch[1] : bunMain.replace(/^.*\//, '');
130
+ if(sandboxMatch) {
131
+ return sandboxMatch[1];
132
+ }
133
+ const cwd = process.cwd();
134
+ // Stryker disable next-line ConditionalExpression,BlockStatement,StringLiteral: inPlace path; covered by the preload-logic tests for cwd-relative prefixes
135
+ if(bunMain.startsWith(`${cwd}/`)) {
136
+ return bunMain.slice(cwd.length + 1);
137
+ }
138
+ // Last resort for a path outside cwd entirely (helper files, node_modules).
139
+ return bunMain.replace(/^.*\//, '');
115
140
  }
116
141
 
117
142
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hughescr/stryker-bun-runner",
3
- "version": "1.3.8",
3
+ "version": "1.4.0",
4
4
  "description": "Stryker test runner plugin for Bun with perTest coverage support",
5
5
  "keywords": [
6
6
  "stryker",
@@ -42,15 +42,15 @@
42
42
  "postversion": "git commit -m \"Bump package version to $npm_package_version\" package.json; git flow release start $npm_package_version; git flow release finish -m $npm_package_version $npm_package_version; git checkout develop; git merge main"
43
43
  },
44
44
  "dependencies": {
45
- "@stryker-mutator/api": "9.6.1",
45
+ "@stryker-mutator/api": "^9.0.0 || ^10.0.0",
46
46
  "smol-toml": "1.7.0",
47
47
  "tinyglobby": "0.2.17",
48
48
  "ws": "8.21.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@hughescr/eslint-config-default": "6.0.1",
52
- "@stryker-mutator/core": "9.6.1",
53
- "@stryker-mutator/typescript-checker": "9.6.1",
52
+ "@stryker-mutator/core": "10.0.0",
53
+ "@stryker-mutator/typescript-checker": "10.0.0",
54
54
  "@types/bun": "1.3.14",
55
55
  "@types/node": "26.1.1",
56
56
  "@types/ws": "8.18.1",
@@ -61,7 +61,7 @@
61
61
  "typescript": "<7.0.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "@stryker-mutator/core": "^9.0.0"
64
+ "@stryker-mutator/core": "^9.0.0 || ^10.0.0"
65
65
  },
66
66
  "engines": {
67
67
  "bun": ">=1.3.7"