diff --git a/src/harness/harness.ts b/src/harness/harness.ts index ec5f6be92e6..9622a6df332 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1456,7 +1456,7 @@ namespace Harness { }); } - export function doTypeAndSymbolBaseline(baselinePath: string, program: ts.Program, allFiles: {unitName: string, content: string}[], opts?: Harness.Baseline.BaselineOptions, multifile?: boolean, skipTypeAndSymbolbaselines?: boolean) { + export function doTypeAndSymbolBaseline(baselinePath: string, program: ts.Program, allFiles: {unitName: string, content: string}[], opts?: Harness.Baseline.BaselineOptions, multifile?: boolean, skipTypeBaselines?: boolean, skipSymbolBaselines?: boolean) { // The full walker simulates the types that you would get from doing a full // compile. The pull walker simulates the types you get when you just do // a type query for a random node (like how the LS would do it). Most of the @@ -1514,19 +1514,19 @@ namespace Harness { baselinePath.replace(/\.tsx?/, "") : baselinePath; if (!multifile) { - const fullBaseLine = generateBaseLine(isSymbolBaseLine, skipTypeAndSymbolbaselines); + const fullBaseLine = generateBaseLine(isSymbolBaseLine, isSymbolBaseLine ? skipSymbolBaselines : skipTypeBaselines); Harness.Baseline.runBaseline(outputFileName + fullExtension, () => fullBaseLine, opts); } else { Harness.Baseline.runMultifileBaseline(outputFileName, fullExtension, () => { - return iterateBaseLine(isSymbolBaseLine, skipTypeAndSymbolbaselines); + return iterateBaseLine(isSymbolBaseLine, isSymbolBaseLine ? skipSymbolBaselines : skipTypeBaselines); }, opts); } } - function generateBaseLine(isSymbolBaseline: boolean, skipTypeAndSymbolbaselines?: boolean): string { + function generateBaseLine(isSymbolBaseline: boolean, skipBaseline?: boolean): string { let result = ""; - const gen = iterateBaseLine(isSymbolBaseline, skipTypeAndSymbolbaselines); + const gen = iterateBaseLine(isSymbolBaseline, skipBaseline); for (let {done, value} = gen.next(); !done; { done, value } = gen.next()) { const [, content] = value; result += content; @@ -1536,8 +1536,8 @@ namespace Harness { /* tslint:enable:no-null-keyword */ } - function *iterateBaseLine(isSymbolBaseline: boolean, skipTypeAndSymbolbaselines?: boolean): IterableIterator<[string, string]> { - if (skipTypeAndSymbolbaselines) { + function *iterateBaseLine(isSymbolBaseline: boolean, skipBaseline?: boolean): IterableIterator<[string, string]> { + if (skipBaseline) { return; } const dupeCase = ts.createMap(); diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 8fe97bb7e12..6675f5c6e7e 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -39,8 +39,8 @@ namespace RWC { const baseName = ts.getBaseFileName(jsonPath); let currentDirectory: string; let useCustomLibraryFile: boolean; - let skipTypeAndSymbolbaselines = false; - const typeAndSymbolSizeLimit = 10000000; + let skipTypeBaselines = false; + const typeSizeLimit = 10000000; after(() => { // Mocha holds onto the closure environment of the describe callback even after the test is done. // Therefore we have to clean out large objects after the test is done. @@ -54,7 +54,7 @@ namespace RWC { // or to use lib.d.ts inside the json object. If the flag is true, use the lib.d.ts inside json file // otherwise use the lib.d.ts from built/local useCustomLibraryFile = undefined; - skipTypeAndSymbolbaselines = false; + skipTypeBaselines = false; }); it("can compile", function(this: Mocha.ITestCallbackContext) { @@ -64,7 +64,7 @@ namespace RWC { const ioLog: IOLog = Playback.newStyleLogIntoOldStyleLog(JSON.parse(Harness.IO.readFile(`internal/cases/rwc/${jsonPath}/test.json`)), Harness.IO, `internal/cases/rwc/${baseName}`); currentDirectory = ioLog.currentDirectory; useCustomLibraryFile = ioLog.useCustomLibraryFile; - skipTypeAndSymbolbaselines = ioLog.filesRead.reduce((acc, elem) => (elem && elem.result && elem.result.contents) ? acc + elem.result.contents.length : acc, 0) > typeAndSymbolSizeLimit; + skipTypeBaselines = ioLog.filesRead.reduce((acc, elem) => (elem && elem.result && elem.result.contents) ? acc + elem.result.contents.length : acc, 0) > typeSizeLimit; runWithIOLog(ioLog, () => { opts = ts.parseCommandLine(ioLog.arguments, fileName => Harness.IO.readFile(fileName)); assert.equal(opts.errors.length, 0); @@ -224,7 +224,7 @@ namespace RWC { Harness.Compiler.doTypeAndSymbolBaseline(baseName, compilerResult.program, inputFiles .concat(otherFiles) .filter(file => !!compilerResult.program.getSourceFile(file.unitName)) - .filter(e => !Harness.isDefaultLibraryFile(e.unitName)), baselineOpts, /*multifile*/ true, skipTypeAndSymbolbaselines); + .filter(e => !Harness.isDefaultLibraryFile(e.unitName)), baselineOpts, /*multifile*/ true, skipTypeBaselines, /*skipSymbolbaselines*/ true); }); // Ideally, a generated declaration file will have no errors. But we allow generated