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.
Files changed (2) hide show
  1. package/cli.js +17 -11
  2. 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 prevFailCount = Infinity;
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 currentFailCount = artifacts.length;
63
+ const currentNames = new Set(artifacts.map(a => a.name));
64
64
 
65
- if (currentFailCount === 0) {
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
- // If failures INCREASED since last attempt, rollback all changes
71
- if (attempt > 1 && currentFailCount > prevFailCount) {
72
- console.log(`${C.RED}âš ī¸ Failures increased (${prevFailCount} → ${currentFailCount}). Rolling back all changes...${C.RESET}`);
73
- for (const [filePath, originalContent] of backups) {
74
- fs.writeFileSync(filePath, originalContent);
75
- console.log(` ${C.YELLOW}â†Šī¸ Restored: ${path.basename(filePath)}${C.RESET}`);
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
- prevFailCount = currentFailCount;
85
+ prevFailNames = currentNames;
80
86
 
81
87
  const applied = await analyzeAndFix(artifacts, client, argv, output, backups);
82
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deflake",
3
- "version": "1.2.39",
3
+ "version": "1.2.41",
4
4
  "description": "AI-powered self-healing tool for Playwright, Cypress, and WebdriverIO tests.",
5
5
  "main": "client.js",
6
6
  "bin": {