From 44cb8b703150d8228465d3880d84323f3b250e87 Mon Sep 17 00:00:00 2001 From: Luan Taraschi <130802253+luantaraschi@users.noreply.github.com> Date: Fri, 7 Aug 2026 09:16:51 -0300 Subject: [PATCH] fix(typescript): map included .ts files in step output Two adjacent blocks in container.js merge a transpile mapping after compiling TypeScript. The helper block merges into store.tsFileMapping; the include/support block merges only into container.tsFileMapping. Step.line() reads store.tsFileMapping, so a step whose stack frame points into an included page object had no entry to match and was printed with the deleted .temp.mjs sibling instead of the .ts source. Error stacks were unaffected because fixErrorStack() is handed the mapping directly. The include block now merges into store as well, mirroring the helper block two hundred lines above it. Closes #5675 --- lib/container.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/container.js b/lib/container.js index 89e80f3d8..193a42e09 100644 --- a/lib/container.js +++ b/lib/container.js @@ -892,6 +892,16 @@ async function loadSupportObject(modulePath, supportObjectName) { for (const [key, value] of mapping.entries()) { container.tsFileMapping.set(key, value) } + // Step.line() maps temp paths back through store, not through the + // container, so an include has to land there too. Without this a step + // that originates in an included .ts page object is printed with the + // deleted .temp.mjs sibling. (#5675) + if (!store.tsFileMapping) { + store.tsFileMapping = new Map() + } + for (const [key, value] of mapping.entries()) { + store.tsFileMapping.set(key, value) + } } catch (tsError) { throw new Error(`Failed to load TypeScript file ${importPath}: ${tsError.message}. Make sure 'typescript' package is installed.`) }