( fileText: string, fileName: string, displayResult = false )
| 188 | } |
| 189 | |
| 190 | const getInstantiationsWithFile = ( |
| 191 | fileText: string, |
| 192 | fileName: string, |
| 193 | displayResult = false |
| 194 | ) => { |
| 195 | const env = getIsolatedEnv() |
| 196 | const file = createOrUpdateFile(env, fileName, fileText) |
| 197 | const program = getProgram(env) |
| 198 | |
| 199 | // trigger type checking to generate instantiations |
| 200 | // (was previously program.emit(file), but that as of TS 5.6 that doesn't |
| 201 | // work, so this may need to change if instantiations is reported as 0 after |
| 202 | // a future TypeScript update) |
| 203 | program.getSemanticDiagnostics(file) |
| 204 | // this may lead to additional type checking per Jake Bailey from the TS |
| 205 | // team, although it doesn't currently affect any of our internal benchmarks |
| 206 | program.getDeclarationDiagnostics(file) |
| 207 | if (displayResult && file) displayBenchResult(program, file) |
| 208 | const count = program.getInstantiationCount() |
| 209 | return count |
| 210 | } |
| 211 | |
| 212 | let virtualEnv: tsvfs.VirtualTypeScriptEnvironment | undefined = undefined |
| 213 |
no test coverage detected