@godzillaba/mutest 1.1.0 → 1.2.1

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 (2) hide show
  1. package/index.ts +14 -8
  2. package/package.json +3 -2
package/index.ts CHANGED
@@ -93,21 +93,27 @@ async function processMutants(
93
93
  );
94
94
  }
95
95
 
96
+ async function loadExistingMutants(): Promise<Mutant[]> {
97
+ const raw = await readFile("gambit_out/gambit_results.json", "utf-8");
98
+ return JSON.parse(raw);
99
+ }
100
+
96
101
  async function main() {
97
102
  const solFiles = process.argv.slice(2);
98
- if (solFiles.length === 0) {
99
- console.error("Usage: mutest <sol-file> [sol-file ...]");
100
- process.exit(1);
101
- }
102
-
103
103
  const workerCount = 10;
104
104
  console.log(`Setting up ${workerCount} workers...`);
105
105
  const tempDir = await setupWorkers(workerCount);
106
106
 
107
107
  try {
108
- console.log(`Running gambit on ${solFiles.join(", ")}...`);
109
- const mutants = await runGambit(solFiles);
110
- console.log(`Generated ${mutants.length} mutants, running tests...\n`);
108
+ let mutants: Mutant[];
109
+ if (solFiles.length > 0) {
110
+ console.log(`Running gambit on ${solFiles.join(", ")}...`);
111
+ mutants = await runGambit(solFiles);
112
+ } else {
113
+ console.log("No files specified, using existing gambit_out/...");
114
+ mutants = await loadExistingMutants();
115
+ }
116
+ console.log(`${mutants.length} mutants, running tests...\n`);
111
117
  await processMutants(tempDir, mutants, workerCount);
112
118
  } finally {
113
119
  await rm(tempDir, { recursive: true, force: true });
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@godzillaba/mutest",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "bin": {
5
5
  "mutest": "./index.ts"
6
6
  },
7
7
  "files": [
8
- "index.ts"
8
+ "index.ts",
9
+ "README.md"
9
10
  ],
10
11
  "dependencies": {
11
12
  "tsx": "^4.21.0"