Skip to content

Commit 44cb8b7

Browse files
committed
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
1 parent 8b91815 commit 44cb8b7

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/container.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,16 @@ async function loadSupportObject(modulePath, supportObjectName) {
892892
for (const [key, value] of mapping.entries()) {
893893
container.tsFileMapping.set(key, value)
894894
}
895+
// Step.line() maps temp paths back through store, not through the
896+
// container, so an include has to land there too. Without this a step
897+
// that originates in an included .ts page object is printed with the
898+
// deleted .temp.mjs sibling. (#5675)
899+
if (!store.tsFileMapping) {
900+
store.tsFileMapping = new Map()
901+
}
902+
for (const [key, value] of mapping.entries()) {
903+
store.tsFileMapping.set(key, value)
904+
}
895905
} catch (tsError) {
896906
throw new Error(`Failed to load TypeScript file ${importPath}: ${tsError.message}. Make sure 'typescript' package is installed.`)
897907
}

0 commit comments

Comments
 (0)