deflake 1.2.45 → 1.2.46

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 +11 -2
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -490,8 +490,17 @@ async function applyFix(res, loc, backups = new Map()) {
490
490
  console.log(` ${C.GREEN}+ Line ${p.line}: ${cleanLine.trim()}${C.RESET}`);
491
491
  }
492
492
  // Case B: Target line is a MIDDLE/CONTINUATION line of a multi-line expression
493
- // Detect: replacement is a complete assignment (this.x = ...; ) but current line is just a string
494
- } else if (/^\s*this\.\w+\s*=/.test(cleanLine) && cleanLine.trim().endsWith(';') && !/^\s*this\./.test(originalLine)) {
493
+ // Detect: replacement is a complete statement but current line is just a string/selector
494
+ // Handles both POM constructors (this.x = page.getByRole...) and inline spec files (await expect(page.getByRole...))
495
+ } else if (
496
+ cleanLine.trim().endsWith(';') &&
497
+ !/^\s*this\./.test(originalLine) &&
498
+ !/^\s*(await|const|let|var|return)/.test(originalLine) &&
499
+ (
500
+ /^\s*this\.\w+\s*=/.test(cleanLine) ||
501
+ /^\s*(await |const |let |var |expect\(|return )/.test(cleanLine)
502
+ )
503
+ ) {
495
504
  // Search BACKWARD for the opening line (this.xxx = page.locator()
496
505
  let startIdx = idx;
497
506
  for (let j = idx - 1; j >= 0; j--) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deflake",
3
- "version": "1.2.45",
3
+ "version": "1.2.46",
4
4
  "description": "AI-powered self-healing tool for Playwright, Cypress, and WebdriverIO tests.",
5
5
  "main": "client.js",
6
6
  "bin": {