* Run the compiler to completion, and assert that no errors occurred.
(customTransformers?: CustomTransformers)
| 247 | * Run the compiler to completion, and assert that no errors occurred. |
| 248 | */ |
| 249 | driveMain(customTransformers?: CustomTransformers): void { |
| 250 | const errorSpy = jasmine.createSpy('consoleError').and.callFake(console.error); |
| 251 | let reuseProgram: {program: Program | undefined} | undefined = undefined; |
| 252 | if (this.multiCompileHostExt !== null) { |
| 253 | reuseProgram = { |
| 254 | program: this.oldProgram || undefined, |
| 255 | }; |
| 256 | } |
| 257 | const exitCode = main( |
| 258 | this.commandLineArgs, |
| 259 | errorSpy, |
| 260 | undefined, |
| 261 | customTransformers, |
| 262 | reuseProgram, |
| 263 | this.changedResources, |
| 264 | ); |
| 265 | |
| 266 | if (errorSpy.calls.count() > 0) { |
| 267 | console.error('>>>', errorSpy.calls.allArgs().join('\n')); |
| 268 | } |
| 269 | expect(errorSpy).not.toHaveBeenCalled(); |
| 270 | |
| 271 | expect(exitCode).toBe(0); |
| 272 | if (this.multiCompileHostExt !== null) { |
| 273 | this.oldProgram = reuseProgram!.program!; |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * Run the compiler to completion, and return any `ts.Diagnostic` errors that may have occurred. |
no test coverage detected