@mutineerjs/mutineer 0.7.0 → 0.8.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.
Files changed (52) hide show
  1. package/README.md +32 -15
  2. package/dist/bin/__tests__/mutineer.spec.js +67 -2
  3. package/dist/bin/mutineer.d.ts +6 -1
  4. package/dist/bin/mutineer.js +55 -1
  5. package/dist/core/__tests__/schemata.spec.d.ts +1 -0
  6. package/dist/core/__tests__/schemata.spec.js +165 -0
  7. package/dist/core/schemata.d.ts +22 -0
  8. package/dist/core/schemata.js +236 -0
  9. package/dist/runner/__tests__/args.spec.js +32 -0
  10. package/dist/runner/__tests__/cleanup.spec.js +7 -0
  11. package/dist/runner/__tests__/coverage-resolver.spec.js +3 -0
  12. package/dist/runner/__tests__/orchestrator.spec.js +183 -18
  13. package/dist/runner/__tests__/pool-executor.spec.js +47 -0
  14. package/dist/runner/__tests__/ts-checker.spec.d.ts +1 -0
  15. package/dist/runner/__tests__/ts-checker.spec.js +115 -0
  16. package/dist/runner/args.d.ts +5 -0
  17. package/dist/runner/args.js +10 -0
  18. package/dist/runner/cleanup.js +1 -1
  19. package/dist/runner/orchestrator.js +98 -17
  20. package/dist/runner/pool-executor.d.ts +2 -0
  21. package/dist/runner/pool-executor.js +15 -4
  22. package/dist/runner/shared/__tests__/mutant-paths.spec.js +30 -1
  23. package/dist/runner/shared/index.d.ts +1 -1
  24. package/dist/runner/shared/index.js +1 -1
  25. package/dist/runner/shared/mutant-paths.d.ts +17 -0
  26. package/dist/runner/shared/mutant-paths.js +24 -0
  27. package/dist/runner/ts-checker-worker.d.ts +5 -0
  28. package/dist/runner/ts-checker-worker.js +66 -0
  29. package/dist/runner/ts-checker.d.ts +36 -0
  30. package/dist/runner/ts-checker.js +210 -0
  31. package/dist/runner/types.d.ts +2 -0
  32. package/dist/runner/vitest/__tests__/plugin.spec.js +151 -0
  33. package/dist/runner/vitest/__tests__/pool.spec.js +85 -0
  34. package/dist/runner/vitest/__tests__/worker-runtime.spec.js +126 -0
  35. package/dist/runner/vitest/adapter.js +1 -0
  36. package/dist/runner/vitest/plugin.d.ts +3 -0
  37. package/dist/runner/vitest/plugin.js +49 -11
  38. package/dist/runner/vitest/pool.d.ts +4 -1
  39. package/dist/runner/vitest/pool.js +25 -4
  40. package/dist/runner/vitest/worker-runtime.d.ts +1 -0
  41. package/dist/runner/vitest/worker-runtime.js +57 -18
  42. package/dist/runner/vitest/worker.mjs +10 -0
  43. package/dist/types/config.d.ts +14 -0
  44. package/dist/types/mutant.d.ts +5 -2
  45. package/dist/utils/CompileErrors.d.ts +7 -0
  46. package/dist/utils/CompileErrors.js +24 -0
  47. package/dist/utils/__tests__/CompileErrors.spec.d.ts +1 -0
  48. package/dist/utils/__tests__/CompileErrors.spec.js +96 -0
  49. package/dist/utils/__tests__/summary.spec.js +83 -1
  50. package/dist/utils/summary.d.ts +5 -1
  51. package/dist/utils/summary.js +38 -3
  52. package/package.json +2 -2
@@ -4,11 +4,15 @@ export interface Summary {
4
4
  readonly killed: number;
5
5
  readonly escaped: number;
6
6
  readonly skipped: number;
7
+ readonly timeouts: number;
8
+ readonly compileErrors: number;
7
9
  readonly evaluated: number;
8
10
  readonly killRate: number;
9
11
  }
10
12
  export declare function computeSummary(cache: Readonly<Record<string, MutantCacheEntry>>): Summary;
11
- export declare function printSummary(summary: Summary, cache?: Readonly<Record<string, MutantCacheEntry>>, durationMs?: number): void;
13
+ export declare function printSummary(summary: Summary, cache?: Readonly<Record<string, MutantCacheEntry>>, durationMs?: number, opts?: {
14
+ skipCompileErrors?: boolean;
15
+ }): void;
12
16
  export interface JsonMutant {
13
17
  readonly file: string;
14
18
  readonly line: number;
@@ -6,18 +6,33 @@ export function computeSummary(cache) {
6
6
  let killed = 0;
7
7
  let escaped = 0;
8
8
  let skipped = 0;
9
+ let timeouts = 0;
10
+ let compileErrors = 0;
9
11
  for (const entry of allEntries) {
10
12
  if (entry.status === 'killed')
11
13
  killed++;
12
14
  else if (entry.status === 'escaped')
13
15
  escaped++;
16
+ else if (entry.status === 'compile-error')
17
+ compileErrors++;
18
+ else if (entry.status === 'timeout')
19
+ timeouts++;
14
20
  else
15
21
  skipped++;
16
22
  }
17
23
  const evaluated = killed + escaped;
18
24
  const total = allEntries.length;
19
25
  const killRate = evaluated === 0 ? 0 : (killed / evaluated) * 100;
20
- return { total, killed, escaped, skipped, evaluated, killRate };
26
+ return {
27
+ total,
28
+ killed,
29
+ escaped,
30
+ skipped,
31
+ timeouts,
32
+ compileErrors,
33
+ evaluated,
34
+ killRate,
35
+ };
21
36
  }
22
37
  function formatDuration(ms) {
23
38
  if (ms < 1000)
@@ -29,7 +44,7 @@ function formatDuration(ms) {
29
44
  const remainingSeconds = seconds % 60;
30
45
  return `${minutes}m ${remainingSeconds.toFixed(1)}s`;
31
46
  }
32
- export function printSummary(summary, cache, durationMs) {
47
+ export function printSummary(summary, cache, durationMs, opts) {
33
48
  console.log('\n' + chalk.dim(SEPARATOR));
34
49
  console.log(chalk.bold(' Mutineer Test Suite Summary'));
35
50
  console.log(chalk.dim(SEPARATOR));
@@ -57,6 +72,8 @@ export function printSummary(summary, cache, durationMs) {
57
72
  const entriesByStatus = {
58
73
  killed: [],
59
74
  escaped: [],
75
+ compileErrors: [],
76
+ timeouts: [],
60
77
  skipped: [],
61
78
  };
62
79
  for (const entry of allEntries) {
@@ -64,6 +81,10 @@ export function printSummary(summary, cache, durationMs) {
64
81
  entriesByStatus.killed.push(entry);
65
82
  else if (entry.status === 'escaped')
66
83
  entriesByStatus.escaped.push(entry);
84
+ else if (entry.status === 'compile-error')
85
+ entriesByStatus.compileErrors.push(entry);
86
+ else if (entry.status === 'timeout')
87
+ entriesByStatus.timeouts.push(entry);
67
88
  else
68
89
  entriesByStatus.skipped.push(entry);
69
90
  }
@@ -92,13 +113,27 @@ export function printSummary(summary, cache, durationMs) {
92
113
  }
93
114
  }
94
115
  }
116
+ if (entriesByStatus.compileErrors.length && !opts?.skipCompileErrors) {
117
+ console.log('\n' + chalk.dim('Compile Error Mutants (type-filtered):'));
118
+ for (const entry of entriesByStatus.compileErrors)
119
+ console.log(' ' + formatRow(entry));
120
+ }
121
+ if (entriesByStatus.timeouts.length) {
122
+ console.log('\n' + chalk.yellow.bold('Timed Out Mutants:'));
123
+ for (const entry of entriesByStatus.timeouts)
124
+ console.log(' ' + formatRow(entry));
125
+ }
95
126
  if (entriesByStatus.skipped.length) {
96
127
  console.log('\n' + chalk.dim('Skipped Mutants:'));
97
128
  for (const entry of entriesByStatus.skipped)
98
129
  console.log(' ' + formatRow(entry));
99
130
  }
100
131
  console.log('\n' + chalk.dim(SEPARATOR));
101
- console.log(`Total: ${summary.total} \u2014 ${chalk.green(`Killed: ${summary.killed}`)}, ${chalk.red(`Escaped: ${summary.escaped}`)}, ${chalk.dim(`Skipped: ${summary.skipped}`)}`);
132
+ const compileErrorStr = summary.compileErrors > 0
133
+ ? `, ${chalk.dim(`Compile Errors: ${summary.compileErrors}`)}`
134
+ : '';
135
+ const timeoutStr = `, ${chalk.yellow(`Timeouts: ${summary.timeouts}`)}`;
136
+ console.log(`Total: ${summary.total} \u2014 ${chalk.green(`Killed: ${summary.killed}`)}, ${chalk.red(`Escaped: ${summary.escaped}`)}, ${chalk.dim(`Skipped: ${summary.skipped}`)}${timeoutStr}${compileErrorStr}`);
102
137
  if (summary.evaluated === 0) {
103
138
  console.log(`Kill rate: ${chalk.dim('0.00% (no mutants executed)')}`);
104
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutineerjs/mutineer",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "A fast, targeted mutation testing framework for JavaScript and TypeScript",
5
5
  "type": "module",
6
6
  "private": false,
@@ -98,7 +98,6 @@
98
98
  }
99
99
  },
100
100
  "devDependencies": {
101
- "@vitest/coverage-v8": "^4.0.15",
102
101
  "@commitlint/cli": "^20.4.3",
103
102
  "@commitlint/config-conventional": "^20.4.3",
104
103
  "@types/babel__traverse": "^7.28.0",
@@ -106,6 +105,7 @@
106
105
  "@types/react": "^19.2.14",
107
106
  "@typescript-eslint/eslint-plugin": "^8.56.1",
108
107
  "@typescript-eslint/parser": "^8.47.0",
108
+ "@vitest/coverage-v8": "^4.0.15",
109
109
  "eslint": "^10.0.3",
110
110
  "husky": "^9.1.7",
111
111
  "jsdom": "^28.1.0",