@avi2dg/checks 0.35.1 → 0.36.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Every release of `@avi2dg/checks`, newest first, written by the release from its conventional commits.
4
4
 
5
+ ## 0.36.0
6
+
7
+ Released 2026-10-08.
8
+
9
+ ### Features
10
+
11
+ - **testing:** add unitTestFiles so each mutant loads only the unit tests that cover it [#132](https://github.com/avi2d/checks/pull/132)
12
+
5
13
  ## 0.35.1
6
14
 
7
15
  Released 2026-10-07.
@@ -23,6 +23,22 @@ The shared Stryker preset makes the same decision from `process.argv` when a `st
23
23
  So a bare `bunx stryker run` in a repository whose `stryker.conf.mjs` spreads the preset is refused the same way, and `checks-mutation` is a thin wrapper over that decision.
24
24
  The preset also registers an ignore plugin that checks the incremental report once Stryker has resolved its options, because a config file can set `incrementalFile` after the preset loads.
25
25
  A config that replaces `plugins` or `ignorers` must keep the preset's entries, or that check does not run.
26
+ The preset also exports `unitTestFiles`, which lists every `.test.ts` and `.test.tsx` file under `tests/unit` at config load.
27
+ A repository sets `bun.testFiles` to its result, so a covered, non-static mutant loads only the test files that cover it.
28
+ A static mutant has no per-test coverage, so it still loads every listed file.
29
+ The config then reads:
30
+
31
+ ```js
32
+ import preset, { unitTestFiles } from "@avi2dg/checks/stryker.preset.js";
33
+
34
+ export default {
35
+ ...preset,
36
+ bun: {
37
+ ...preset.bun,
38
+ testFiles: unitTestFiles(),
39
+ },
40
+ };
41
+ ```
26
42
 
27
43
  ## What it reads
28
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avi2dg/checks",
3
- "version": "0.35.1",
3
+ "version": "0.36.0",
4
4
  "description": "Deterministic checks shared across a set of TypeScript repositories",
5
5
  "license": "MIT",
6
6
  "repository": {
package/stryker.preset.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { readdirSync } from "node:fs";
1
2
  import { availableParallelism } from "node:os";
2
3
  import { fileURLToPath } from "node:url";
3
4
  import { GUARD_IGNORER } from "./src/testing/mutation-guard-plugin.js";
@@ -9,6 +10,13 @@ if (refusal !== undefined) throw new Error(refusal);
9
10
 
10
11
  export const halfAvailableCores = (cores = availableParallelism()) => Math.max(1, Math.floor(cores / 2));
11
12
 
13
+ // The bun runner narrows a mutant's run to its covering files only when each listed path equals a test id's file part, which carries no leading ./.
14
+ export const unitTestFiles = () =>
15
+ readdirSync("tests/unit", { recursive: true, encoding: "utf8" })
16
+ .filter((name) => name.endsWith(".test.ts") || name.endsWith(".test.tsx"))
17
+ .map((name) => `tests/unit/${name}`)
18
+ .toSorted();
19
+
12
20
  export default {
13
21
  packageManager: "npm",
14
22
  plugins: [