@mutineerjs/mutineer 0.5.1 → 0.7.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 (48) hide show
  1. package/README.md +42 -2
  2. package/dist/bin/__tests__/mutineer.spec.d.ts +1 -0
  3. package/dist/bin/__tests__/mutineer.spec.js +43 -0
  4. package/dist/bin/mutineer.d.ts +2 -1
  5. package/dist/bin/mutineer.js +44 -1
  6. package/dist/mutators/__tests__/operator.spec.js +97 -1
  7. package/dist/mutators/__tests__/registry.spec.js +8 -0
  8. package/dist/mutators/operator.d.ts +8 -0
  9. package/dist/mutators/operator.js +58 -1
  10. package/dist/mutators/registry.js +9 -1
  11. package/dist/mutators/utils.d.ts +2 -0
  12. package/dist/mutators/utils.js +58 -1
  13. package/dist/runner/__tests__/args.spec.js +101 -1
  14. package/dist/runner/__tests__/cache.spec.js +65 -8
  15. package/dist/runner/__tests__/changed.spec.js +85 -2
  16. package/dist/runner/__tests__/cleanup.spec.js +30 -0
  17. package/dist/runner/__tests__/config.spec.js +2 -13
  18. package/dist/runner/__tests__/coverage-resolver.spec.js +9 -2
  19. package/dist/runner/__tests__/discover.spec.js +128 -0
  20. package/dist/runner/__tests__/orchestrator.spec.d.ts +1 -0
  21. package/dist/runner/__tests__/orchestrator.spec.js +306 -0
  22. package/dist/runner/__tests__/pool-executor.spec.js +60 -1
  23. package/dist/runner/args.d.ts +18 -0
  24. package/dist/runner/args.js +40 -0
  25. package/dist/runner/cache.d.ts +19 -3
  26. package/dist/runner/cache.js +14 -7
  27. package/dist/runner/changed.js +15 -43
  28. package/dist/runner/cleanup.d.ts +3 -1
  29. package/dist/runner/cleanup.js +18 -1
  30. package/dist/runner/config.js +1 -1
  31. package/dist/runner/coverage-resolver.js +1 -1
  32. package/dist/runner/discover.d.ts +1 -1
  33. package/dist/runner/discover.js +30 -20
  34. package/dist/runner/jest/__tests__/pool.spec.js +41 -0
  35. package/dist/runner/jest/pool.js +3 -3
  36. package/dist/runner/orchestrator.d.ts +1 -0
  37. package/dist/runner/orchestrator.js +38 -9
  38. package/dist/runner/pool-executor.d.ts +5 -0
  39. package/dist/runner/pool-executor.js +15 -4
  40. package/dist/runner/vitest/__tests__/adapter.spec.js +60 -0
  41. package/dist/runner/vitest/__tests__/pool.spec.js +57 -0
  42. package/dist/runner/vitest/adapter.js +16 -9
  43. package/dist/runner/vitest/pool.js +3 -3
  44. package/dist/types/config.d.ts +4 -0
  45. package/dist/utils/__tests__/summary.spec.js +43 -1
  46. package/dist/utils/summary.d.ts +18 -0
  47. package/dist/utils/summary.js +25 -0
  48. package/package.json +2 -1
@@ -9,4 +9,22 @@ export interface Summary {
9
9
  }
10
10
  export declare function computeSummary(cache: Readonly<Record<string, MutantCacheEntry>>): Summary;
11
11
  export declare function printSummary(summary: Summary, cache?: Readonly<Record<string, MutantCacheEntry>>, durationMs?: number): void;
12
+ export interface JsonMutant {
13
+ readonly file: string;
14
+ readonly line: number;
15
+ readonly col: number;
16
+ readonly mutator: string;
17
+ readonly status: string;
18
+ readonly originalSnippet?: string;
19
+ readonly mutatedSnippet?: string;
20
+ readonly coveringTests?: readonly string[];
21
+ }
22
+ export interface JsonReport {
23
+ readonly schemaVersion: 1;
24
+ readonly timestamp: string;
25
+ readonly durationMs?: number;
26
+ readonly summary: Summary;
27
+ readonly mutants: JsonMutant[];
28
+ }
29
+ export declare function buildJsonReport(summary: Summary, cache: Readonly<Record<string, MutantCacheEntry>>, durationMs?: number): JsonReport;
12
30
  export declare function summarise(cache: Readonly<Record<string, MutantCacheEntry>>): Summary;
@@ -115,6 +115,31 @@ export function printSummary(summary, cache, durationMs) {
115
115
  }
116
116
  console.log(chalk.dim(SEPARATOR) + '\n');
117
117
  }
118
+ export function buildJsonReport(summary, cache, durationMs) {
119
+ const mutants = Object.values(cache).map((entry) => ({
120
+ file: entry.file,
121
+ line: entry.line,
122
+ col: entry.col,
123
+ mutator: entry.mutator,
124
+ status: entry.status,
125
+ ...(entry.originalSnippet !== undefined && {
126
+ originalSnippet: entry.originalSnippet,
127
+ }),
128
+ ...(entry.mutatedSnippet !== undefined && {
129
+ mutatedSnippet: entry.mutatedSnippet,
130
+ }),
131
+ ...(entry.coveringTests !== undefined && {
132
+ coveringTests: entry.coveringTests,
133
+ }),
134
+ }));
135
+ return {
136
+ schemaVersion: 1,
137
+ timestamp: new Date().toISOString(),
138
+ ...(durationMs !== undefined && { durationMs }),
139
+ summary,
140
+ mutants,
141
+ };
142
+ }
118
143
  export function summarise(cache) {
119
144
  const s = computeSummary(cache);
120
145
  printSummary(s, cache);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutineerjs/mutineer",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "description": "A fast, targeted mutation testing framework for JavaScript and TypeScript",
5
5
  "type": "module",
6
6
  "private": false,
@@ -98,6 +98,7 @@
98
98
  }
99
99
  },
100
100
  "devDependencies": {
101
+ "@vitest/coverage-v8": "^4.0.15",
101
102
  "@commitlint/cli": "^20.4.3",
102
103
  "@commitlint/config-conventional": "^20.4.3",
103
104
  "@types/babel__traverse": "^7.28.0",