diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 7045a1196d0..4ca33f92804 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -10,7 +10,7 @@ const enum CompilerTestType { } class CompilerBaselineRunner extends RunnerBase { - private basePath = 'tests/cases'; + protected basePath = 'tests/cases'; private errors: boolean; private emit: boolean; private decl: boolean; @@ -113,10 +113,7 @@ class CompilerBaselineRunner extends RunnerBase { for (var i = 0; i < tcSettings.length; ++i) { // noImplicitAny is passed to getCompiler, but target is just passed in the settings blob to setCompilerSettings if (!createNewInstance && (tcSettings[i].flag == "noimplicitany" || tcSettings[i].flag === 'target')) { - harnessCompiler = Harness.Compiler.getCompiler({ - useExistingInstance: false, - optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: tcSettings[i].flag === "noimplicitany" } - }); + harnessCompiler = Harness.Compiler.getCompiler(); harnessCompiler.setCompilerSettings(tcSettings); createNewInstance = true; } @@ -125,10 +122,7 @@ class CompilerBaselineRunner extends RunnerBase { afterEach(() => { if (createNewInstance) { - harnessCompiler = Harness.Compiler.getCompiler({ - useExistingInstance: false, - optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: false } - }); + harnessCompiler = Harness.Compiler.getCompiler(); createNewInstance = false; } }); @@ -312,10 +306,7 @@ class CompilerBaselineRunner extends RunnerBase { public initializeTests() { describe("Setup compiler for compiler baselines", () => { - var harnessCompiler = Harness.Compiler.getCompiler({ - useExistingInstance: false, - optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: false } - }); + var harnessCompiler = Harness.Compiler.getCompiler(); this.parseOptions(); }); @@ -332,10 +323,7 @@ class CompilerBaselineRunner extends RunnerBase { } describe("Cleanup after compiler baselines", () => { - var harnessCompiler = Harness.Compiler.getCompiler({ - useExistingInstance: false, - optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: false } - }); + var harnessCompiler = Harness.Compiler.getCompiler(); }); } diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index b7e59437456..1ecb02df292 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -15,10 +15,6 @@ class FourslashRunner extends RunnerBase { } describe("fourslash tests", () => { - before(() => { - Harness.Compiler.getCompiler({ useExistingInstance: false }); - }); - this.tests.forEach((fn: string) => { fn = ts.normalizeSlashes(fn); var justName = fn.replace(/^.*[\\\/]/, ''); @@ -33,10 +29,6 @@ class FourslashRunner extends RunnerBase { }); } }); - - after(() => { - Harness.Compiler.getCompiler({ useExistingInstance: false }); - }); }); describe('Generate Tao XML', () => { diff --git a/src/harness/harness.ts b/src/harness/harness.ts index f9c20a1893a..3bc635e2ab4 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1029,7 +1029,7 @@ module Harness { /** Returns the singleton harness compiler instance for generating and running tests. If required a fresh compiler instance will be created, otherwise the existing singleton will be re-used. */ - export function getCompiler(opts?: { useExistingInstance: boolean; optionsForFreshInstance?: { useMinimalDefaultLib: boolean; noImplicitAny: boolean; } }) { + export function getCompiler() { return harnessCompiler = harnessCompiler || new HarnessCompiler(); }