Problem
src/transformer.ts is currently 2,303 lines - the largest file in the codebase by far. It handles all Cypress-to-Playwright chain conversions in a single file, making it difficult to navigate, test, and maintain.
Proposed Solution
Split transformer.ts into focused, single-responsibility modules:
Suggested structure
src/ transformer/ index.ts # Public API (transformFile, parseCustomCommands) chain-converter.ts # convertCypressChain - the core dispatch logic chains/ get-chain.ts # convertGetChain (~300 lines) url-chain.ts # convertUrlChain (~50 lines) title-chain.ts # convertTitleChain (~40 lines) cy-on.ts # convertCyOn (~70 lines) cy-stub.ts # convertCyStub (~90 lines) cy-request.ts # convertCyRequest (~290 lines) assertions/ should-converter.ts # convertShouldAssertion (~100 lines) blocks/ block-accumulator.ts # accumulateBlock intercept-handler.ts # convertCyIntercept wait-handler.ts # convertCyWait each-handler.ts # convertCyEach window-handler.ts # convertCyWindow within-handler.ts # convertCyWithin custom-commands.ts # CustomCommandDef, parseCustomCommands types.ts # ChainCall, ChainConversionResult, etc. utils.ts # Shared helpers (quote stripping, indent, etc.)
Benefits
- Readability: Each file is focused on one conversion type
- Testability: Individual chain converters can be unit tested in isolation
- Maintainability: Adding new chain converters doesn't bloat a single file
- Discoverability: New contributors can find what they need quickly
Migration Plan
- Create the src/transformer/ directory structure
- Extract chain converters one at a time (start with the smallest)
- Keep the public API (transformFile, parseCustomCommands) stable via re-exports from index.ts
- Update imports across the codebase
- Run full test suite after each extraction to verify nothing breaks
Acceptance Criteria
Problem
src/transformer.ts is currently 2,303 lines - the largest file in the codebase by far. It handles all Cypress-to-Playwright chain conversions in a single file, making it difficult to navigate, test, and maintain.
Proposed Solution
Split transformer.ts into focused, single-responsibility modules:
Suggested structure
src/ transformer/ index.ts # Public API (transformFile, parseCustomCommands) chain-converter.ts # convertCypressChain - the core dispatch logic chains/ get-chain.ts # convertGetChain (~300 lines) url-chain.ts # convertUrlChain (~50 lines) title-chain.ts # convertTitleChain (~40 lines) cy-on.ts # convertCyOn (~70 lines) cy-stub.ts # convertCyStub (~90 lines) cy-request.ts # convertCyRequest (~290 lines) assertions/ should-converter.ts # convertShouldAssertion (~100 lines) blocks/ block-accumulator.ts # accumulateBlock intercept-handler.ts # convertCyIntercept wait-handler.ts # convertCyWait each-handler.ts # convertCyEach window-handler.ts # convertCyWindow within-handler.ts # convertCyWithin custom-commands.ts # CustomCommandDef, parseCustomCommands types.ts # ChainCall, ChainConversionResult, etc. utils.ts # Shared helpers (quote stripping, indent, etc.)Benefits
Migration Plan
Acceptance Criteria