@@ -106,7 +106,7 @@ namespace ts {
106106 getCurrentDirectory : notImplemented ,
107107 } ;
108108
109- export function testExtractSymbol ( caption : string , text : string , baselineFolder : string , description : DiagnosticMessage ) {
109+ export function testExtractSymbol ( caption : string , text : string , baselineFolder : string , description : DiagnosticMessage , includeLib ?: boolean ) {
110110 const t = extractTest ( text ) ;
111111 const selectionRange = t . ranges . get ( "selection" ) ;
112112 if ( ! selectionRange ) {
@@ -118,7 +118,7 @@ namespace ts {
118118
119119 function runBaseline ( extension : Extension ) {
120120 const path = "/a" + extension ;
121- const program = makeProgram ( { path, content : t . source } ) ;
121+ const program = makeProgram ( { path, content : t . source } , includeLib ) ;
122122
123123 if ( hasSyntacticDiagnostics ( program ) ) {
124124 // Don't bother generating JS baselines for inputs that aren't valid JS.
@@ -154,15 +154,15 @@ namespace ts {
154154 const newTextWithRename = newText . slice ( 0 , renameLocation ) + "/*RENAME*/" + newText . slice ( renameLocation ) ;
155155 data . push ( newTextWithRename ) ;
156156
157- const diagProgram = makeProgram ( { path, content : newText } ) ;
157+ const diagProgram = makeProgram ( { path, content : newText } , includeLib ) ;
158158 assert . isFalse ( hasSyntacticDiagnostics ( diagProgram ) ) ;
159159 }
160160 return data . join ( newLineCharacter ) ;
161161 } ) ;
162162 }
163163
164- function makeProgram ( f : { path : string , content : string } ) {
165- const host = projectSystem . createServerHost ( [ f , projectSystem . libFile ] ) ;
164+ function makeProgram ( f : { path : string , content : string } , includeLib ?: boolean ) {
165+ const host = projectSystem . createServerHost ( includeLib ? [ f , projectSystem . libFile ] : [ f ] ) ; // libFile is expensive to parse repeatedly - only test when required
166166 const projectService = projectSystem . createProjectService ( host ) ;
167167 projectService . openClientFile ( f . path ) ;
168168 const program = projectService . inferredProjects [ 0 ] . getLanguageService ( ) . getProgram ( ) ;
0 commit comments