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.`) }