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.
- package/cli.js +11 -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
|
|
494
|
-
|
|
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--) {
|