Skip to content

fix(typescript): map step line/column back to .ts source via inline sourcemaps - #5782

Open
azdemir wants to merge 1 commit into
codeceptjs:4.xfrom
azdemir:fix/5772-ts-step-line-column-sourcemap
Open

azdemir wants to merge 1 commit into
codeceptjs:4.xfrom
azdemir:fix/5772-ts-step-line-column-sourcemap

Conversation

@azdemir

@azdemir azdemir commented Nov 1, 2026

Copy link
Copy Markdown

Follow-up to #5685: the file path in Scenario Steps was mapped back to the original .ts file, but line/column still came from the transpiled .temp.mjs (TypeScript's emitter elides statements and drops blank lines, so positions shift).

This transpiles with transpileModule and inlines the source map into each temp file, then maps step stack frames back to the original .ts positions via the map (accounting for injected CommonJS shims by shifting the map's generated lines). The previous path-only replacement stays as a fallback. Verified end-to-end with the repo's own sandbox:

  • before: ✔ I.doThing("from page") at Object.open (./pages/fooPage.ts:4:11)
  • after: ✔ I.doThing("from page") at Object.open (./pages/fooPage.ts:7:7) (correct)

New unit tests cover the mapping helper (including the shim line-shift path); the existing typescript_step_paths runner test now asserts the exact position. Emitted code is byte-identical to transpile() apart from the map comment.

Fixes #5772.

@DavertMik
DavertMik requested a review from DenysKuchma November 1, 2026 19:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scenario Steps report wrong line/column for TypeScript include modules

1 participant