@godzillaba/mutest 1.1.1 → 1.2.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/index.ts +15 -9
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -21,7 +21,7 @@ async function setupWorkers(workerCount: number): Promise<string> {
|
|
|
21
21
|
const dir = `${root}/worker-${i}`;
|
|
22
22
|
return execFile("bash", [
|
|
23
23
|
"-c",
|
|
24
|
-
`mkdir -p "${dir}" && git ls-files -z | tar -c --null -T - | tar -x -C "${dir}" && ln -s ${cwd}/node_modules ${dir}/node_modules && ln -s ${cwd}/lib ${dir}/lib`,
|
|
24
|
+
`mkdir -p "${dir}" && git ls-files -z --cached --others --exclude-standard | tar -c --null -T - | tar -x -C "${dir}" && ln -s ${cwd}/node_modules ${dir}/node_modules && ln -s ${cwd}/lib ${dir}/lib`,
|
|
25
25
|
]);
|
|
26
26
|
});
|
|
27
27
|
await Promise.all(workers);
|
|
@@ -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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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 });
|