diff --git a/packages/playwright-core/src/utils/sequence.ts b/packages/playwright-core/src/utils/sequence.ts index 2af5429bd6..27756fabeb 100644 --- a/packages/playwright-core/src/utils/sequence.ts +++ b/packages/playwright-core/src/utils/sequence.ts @@ -20,10 +20,13 @@ export function findRepeatedSubsequences(s: string[]): { sequence: string[]; cou let i = 0; const arraysEqual = (a1: string[], a2: string[]) => { - if (a1.length !== a2.length) return false; + if (a1.length !== a2.length) + return false; for (let j = 0; j < a1.length; j++) { - if (a1[j] !== a2[j]) return false; + if (a1[j] !== a2[j]) + return false; } + return true; }; @@ -41,9 +44,9 @@ export function findRepeatedSubsequences(s: string[]): { sequence: string[]; cou while ( i + p * k <= n && arraysEqual(s.slice(i + p * (k - 1), i + p * k), substr) - ) { + ) k += 1; - } + k -= 1; // Adjust k since it increments one extra time in the loop // Update the maximal repeating substring if necessary diff --git a/packages/playwright-core/src/utils/stackTrace.ts b/packages/playwright-core/src/utils/stackTrace.ts index 9969346f28..84d08b0184 100644 --- a/packages/playwright-core/src/utils/stackTrace.ts +++ b/packages/playwright-core/src/utils/stackTrace.ts @@ -16,7 +16,6 @@ import path from 'path'; import { parseStackTraceLine } from '../utilsBundle'; -import { isUnderTest } from './'; import type { StackFrame } from '@protocol/channels'; import { colors } from '../utilsBundle'; import { findRepeatedSubsequences } from './sequence';