mutant-cafe 0.1.1 → 0.1.2

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,11 +8,11 @@ It is inspired by [cargo-mutants](https://mutants.rs) by Martin Pool ([source](h
8
8
 
9
9
  ## What it adds for Effect
10
10
 
11
- An `Effect<A, E, R>` declares its failures in `E`. For each tagged error in `E`, mutant.cafe makes a mutant that swallows that error and succeeds instead. If your tests still pass, no test drives that failure path.
11
+ An `Effect<A, E, R>` declares its failures in `E`. For each tagged error in `E`, mutant.cafe makes a mutant that swallows that error and succeeds instead. If no value of `A` can be synthesized, a separate `TagToDefect` mutant turns that tag into a defect. That is not a successful recovery: it checks whether tests distinguish typed failures from defects, rather than only asserting `Exit.isFailure`.
12
12
 
13
13
  Other mutants, all chosen from the checker's view of the return type:
14
14
 
15
- - `Effect.succeed(value)` for plausible values of `A`, `Effect.fail` of each tag, `Effect.die`, and `Effect.never` behind a short timeout
15
+ - `Effect.succeed(value)` for plausible values of `A`, `Effect.fail` of each tag, `Effect.die`, and `Effect.never` behind a measured timeout
16
16
  - `Option.none()` and `Option.some(value)`
17
17
  - `Stream.empty`, a one-element stream, and a failing stream
18
18
  - a `Layer` that fails at build
@@ -32,7 +32,7 @@ Run it from the package whose tests you want to check. In a monorepo that resolv
32
32
 
33
33
  | Flag | Meaning |
34
34
  | --- | --- |
35
- | `--list` | print the mutants and exit |
35
+ | `--list` | print the mutants, per-file counts and a total, then exit |
36
36
  | `--in-diff <file>` | only mutants on lines a unified diff adds or changes |
37
37
  | `--file <glob>`, `--exclude <glob>` | choose source files (repeatable) |
38
38
  | `--jobs <n>` | scratch copies tested in parallel |
@@ -41,18 +41,25 @@ Run it from the package whose tests you want to check. In a monorepo that resolv
41
41
  | `--output <dir>` | results directory, default `mutants.out` |
42
42
  | `--tsconfig <path>` | default `tsconfig.json` |
43
43
 
44
- Results land in `mutants.out/`: `missed.txt`, `caught.txt`, `timeout.txt`, `unviable.txt`, a diff and a log per mutant, and `outcomes.json`. Add `mutants.out*` to `.gitignore`. Your source tree is never edited: each mutant runs in a scratch copy.
44
+ Results land in `mutants.out/`: `missed.txt`, `caught.txt`, `timeout.txt`, `unviable.txt`, `untested.txt`, a context diff and a log per mutant, and `outcomes.json`. Every result line includes the mutant id used by `diff/<id>.diff` and `logs/<id>.log`. Lines show the declared return type when available, or an abbreviated inferred type; JSON keeps full types. Add `mutants.out*` to `.gitignore`. Your source tree is never edited: each mutant runs in a scratch copy.
45
45
 
46
- Exit codes: 0 every viable mutant was caught, 1 usage error, 2 some mutants were missed, 3 some timed out, 4 the baseline tests fail, 5 the `--in-diff` diff doesn't match the tree, 6 the diff can't be parsed, 70 internal error.
46
+ An include glob that matches no source file is a usage error, including a path outside the package root. Diff paths resolve from the Git toplevel, with support for `git diff --relative`; outside Git they resolve from the working directory.
47
+
48
+ Exit codes: 0 no missed, untested or timed-out mutants, 1 usage error, 2 some mutants were missed or untested, 3 some timed out with none missed or untested, 4 the baseline tests fail, 5 the `--in-diff` diff doesn't match the tree, 6 the diff can't be parsed, 70 internal error. **Missed or untested takes precedence over timeout:** a run with both exits 2.
47
49
 
48
50
  ## Outcomes
49
51
 
50
52
  | Outcome | Meaning |
51
53
  | --- | --- |
52
- | caught | a related test failed |
53
- | missed | every related test passed |
54
+ | caught | a test failed, or a collected test run hung on `Effect.never` past its measured budget |
55
+ | missed | the selected tests passed |
54
56
  | unviable | the mutant does not type-check |
55
- | timeout | the tests ran past the per-mutant timeout |
57
+ | timeout | the tests ran past the per-mutant budget without a reported failure or evidence of a caught `Effect.never` |
58
+ | untested | neither related selection nor the package's full suite found any test files |
59
+
60
+ Vitest first runs tests related to the mutated file. When that selects no test files, mutant.cafe reruns the package's full suite within the remaining budget. Selection and partial failures come from Vitest's reporter hooks, not its human-readable messages. A reported failure still counts as caught if another test file hangs.
61
+
62
+ Ordinary mutants use the configured timeout. For `Effect.never`, mutant.cafe measures the unmutated related run once per file, including any full-suite fallback. Its budget is that duration × the timeout multiplier, with a 1 s floor. Slow tests that never call the function can finish normally; a process killed before test collection is not credited as caught. Each mutant run also sets Vitest's per-test timeout to half its budget, overriding a package's `testTimeout: 0`, and stops after the first reported failure.
56
63
 
57
64
  ## Prior art
58
65