deflake 1.2.39 â 1.2.41
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/cli.js +17 -11
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -54,29 +54,35 @@ async function main() {
|
|
|
54
54
|
|
|
55
55
|
// Save backups of all source files before any modifications
|
|
56
56
|
const backups = new Map(); // path -> original content
|
|
57
|
-
let
|
|
57
|
+
let prevFailNames = new Set(); // Track specific failures by name
|
|
58
58
|
|
|
59
59
|
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
60
60
|
console.log(`\n${C.BRIGHT}${C.CYAN}đ Fix attempt ${attempt}/${MAX_ATTEMPTS}${C.RESET}`);
|
|
61
61
|
|
|
62
62
|
const artifacts = detectFailures();
|
|
63
|
-
const
|
|
63
|
+
const currentNames = new Set(artifacts.map(a => a.name));
|
|
64
64
|
|
|
65
|
-
if (
|
|
65
|
+
if (artifacts.length === 0) {
|
|
66
66
|
console.log(`${C.GREEN}đ All tests passing! No failures detected.${C.RESET}`);
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
//
|
|
71
|
-
if (attempt > 1
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
// Check for NEW failures (tests that weren't failing before)
|
|
71
|
+
if (attempt > 1) {
|
|
72
|
+
const newFailures = [...currentNames].filter(n => !prevFailNames.has(n));
|
|
73
|
+
if (newFailures.length > 0) {
|
|
74
|
+
console.log(`${C.RED}â ī¸ New failures detected after fix attempt! Rolling back all changes...${C.RESET}`);
|
|
75
|
+
for (const name of newFailures) {
|
|
76
|
+
console.log(` ${C.RED}đ ${name}${C.RESET}`);
|
|
77
|
+
}
|
|
78
|
+
for (const [filePath, originalContent] of backups) {
|
|
79
|
+
fs.writeFileSync(filePath, originalContent);
|
|
80
|
+
console.log(` ${C.YELLOW}âŠī¸ Restored: ${path.basename(filePath)}${C.RESET}`);
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
76
83
|
}
|
|
77
|
-
break;
|
|
78
84
|
}
|
|
79
|
-
|
|
85
|
+
prevFailNames = currentNames;
|
|
80
86
|
|
|
81
87
|
const applied = await analyzeAndFix(artifacts, client, argv, output, backups);
|
|
82
88
|
|