Skip to content

Commit cd3bb39

Browse files
jakebaileysnovader
authored andcommitted
Partially revert PR 55723 to fix OOM in testing (microsoft#55822)
1 parent b926da3 commit cd3bb39

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/harness/fakesHosts.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,12 @@ export class CompilerHost implements ts.CompilerHost {
366366
// reused across multiple tests. In that case, we cache the SourceFile we parse
367367
// so that it can be reused across multiple tests to avoid the cost of
368368
// repeatedly parsing the same file over and over (such as lib.d.ts).
369-
const cacheKey = this.vfs.shadowRoot && `SourceFile[languageVersionOrOptions=${languageVersionOrOptions !== undefined ? JSON.stringify(languageVersionOrOptions) : undefined},setParentNodes=${this._setParentNodes}]`;
369+
370+
// TODO(jakebailey): the below is totally wrong; languageVersionOrOptions can be an object,
371+
// and so any options bag will be keyed as "[object Object]", and we'll incorrectly share
372+
// SourceFiles parsed with different options. But fixing this doesn't expose any bugs and
373+
// doubles the memory usage of a test run, so I'm leaving it for now.
374+
const cacheKey = this.vfs.shadowRoot && `SourceFile[languageVersionOrOptions=${languageVersionOrOptions},setParentNodes=${this._setParentNodes}]`;
370375
if (cacheKey) {
371376
const meta = this.vfs.filemeta(canonicalFileName);
372377
const sourceFileFromMetadata = meta.get(cacheKey) as ts.SourceFile | undefined;

0 commit comments

Comments
 (0)