Skip to content

Commit 538f1bf

Browse files
authored
Skip symbol baselines for RWC tests (microsoft#19425)
1 parent a1e3f00 commit 538f1bf

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/harness/harness.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ namespace Harness {
14561456
});
14571457
}
14581458

1459-
export function doTypeAndSymbolBaseline(baselinePath: string, program: ts.Program, allFiles: {unitName: string, content: string}[], opts?: Harness.Baseline.BaselineOptions, multifile?: boolean, skipTypeAndSymbolbaselines?: boolean) {
1459+
export function doTypeAndSymbolBaseline(baselinePath: string, program: ts.Program, allFiles: {unitName: string, content: string}[], opts?: Harness.Baseline.BaselineOptions, multifile?: boolean, skipTypeBaselines?: boolean, skipSymbolBaselines?: boolean) {
14601460
// The full walker simulates the types that you would get from doing a full
14611461
// compile. The pull walker simulates the types you get when you just do
14621462
// a type query for a random node (like how the LS would do it). Most of the
@@ -1514,19 +1514,19 @@ namespace Harness {
15141514
baselinePath.replace(/\.tsx?/, "") : baselinePath;
15151515

15161516
if (!multifile) {
1517-
const fullBaseLine = generateBaseLine(isSymbolBaseLine, skipTypeAndSymbolbaselines);
1517+
const fullBaseLine = generateBaseLine(isSymbolBaseLine, isSymbolBaseLine ? skipSymbolBaselines : skipTypeBaselines);
15181518
Harness.Baseline.runBaseline(outputFileName + fullExtension, () => fullBaseLine, opts);
15191519
}
15201520
else {
15211521
Harness.Baseline.runMultifileBaseline(outputFileName, fullExtension, () => {
1522-
return iterateBaseLine(isSymbolBaseLine, skipTypeAndSymbolbaselines);
1522+
return iterateBaseLine(isSymbolBaseLine, isSymbolBaseLine ? skipSymbolBaselines : skipTypeBaselines);
15231523
}, opts);
15241524
}
15251525
}
15261526

1527-
function generateBaseLine(isSymbolBaseline: boolean, skipTypeAndSymbolbaselines?: boolean): string {
1527+
function generateBaseLine(isSymbolBaseline: boolean, skipBaseline?: boolean): string {
15281528
let result = "";
1529-
const gen = iterateBaseLine(isSymbolBaseline, skipTypeAndSymbolbaselines);
1529+
const gen = iterateBaseLine(isSymbolBaseline, skipBaseline);
15301530
for (let {done, value} = gen.next(); !done; { done, value } = gen.next()) {
15311531
const [, content] = value;
15321532
result += content;
@@ -1536,8 +1536,8 @@ namespace Harness {
15361536
/* tslint:enable:no-null-keyword */
15371537
}
15381538

1539-
function *iterateBaseLine(isSymbolBaseline: boolean, skipTypeAndSymbolbaselines?: boolean): IterableIterator<[string, string]> {
1540-
if (skipTypeAndSymbolbaselines) {
1539+
function *iterateBaseLine(isSymbolBaseline: boolean, skipBaseline?: boolean): IterableIterator<[string, string]> {
1540+
if (skipBaseline) {
15411541
return;
15421542
}
15431543
const dupeCase = ts.createMap<number>();

src/harness/rwcRunner.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ namespace RWC {
3939
const baseName = ts.getBaseFileName(jsonPath);
4040
let currentDirectory: string;
4141
let useCustomLibraryFile: boolean;
42-
let skipTypeAndSymbolbaselines = false;
43-
const typeAndSymbolSizeLimit = 10000000;
42+
let skipTypeBaselines = false;
43+
const typeSizeLimit = 10000000;
4444
after(() => {
4545
// Mocha holds onto the closure environment of the describe callback even after the test is done.
4646
// Therefore we have to clean out large objects after the test is done.
@@ -54,7 +54,7 @@ namespace RWC {
5454
// or to use lib.d.ts inside the json object. If the flag is true, use the lib.d.ts inside json file
5555
// otherwise use the lib.d.ts from built/local
5656
useCustomLibraryFile = undefined;
57-
skipTypeAndSymbolbaselines = false;
57+
skipTypeBaselines = false;
5858
});
5959

6060
it("can compile", function(this: Mocha.ITestCallbackContext) {
@@ -64,7 +64,7 @@ namespace RWC {
6464
const ioLog: IOLog = Playback.newStyleLogIntoOldStyleLog(JSON.parse(Harness.IO.readFile(`internal/cases/rwc/${jsonPath}/test.json`)), Harness.IO, `internal/cases/rwc/${baseName}`);
6565
currentDirectory = ioLog.currentDirectory;
6666
useCustomLibraryFile = ioLog.useCustomLibraryFile;
67-
skipTypeAndSymbolbaselines = ioLog.filesRead.reduce((acc, elem) => (elem && elem.result && elem.result.contents) ? acc + elem.result.contents.length : acc, 0) > typeAndSymbolSizeLimit;
67+
skipTypeBaselines = ioLog.filesRead.reduce((acc, elem) => (elem && elem.result && elem.result.contents) ? acc + elem.result.contents.length : acc, 0) > typeSizeLimit;
6868
runWithIOLog(ioLog, () => {
6969
opts = ts.parseCommandLine(ioLog.arguments, fileName => Harness.IO.readFile(fileName));
7070
assert.equal(opts.errors.length, 0);
@@ -224,7 +224,7 @@ namespace RWC {
224224
Harness.Compiler.doTypeAndSymbolBaseline(baseName, compilerResult.program, inputFiles
225225
.concat(otherFiles)
226226
.filter(file => !!compilerResult.program.getSourceFile(file.unitName))
227-
.filter(e => !Harness.isDefaultLibraryFile(e.unitName)), baselineOpts, /*multifile*/ true, skipTypeAndSymbolbaselines);
227+
.filter(e => !Harness.isDefaultLibraryFile(e.unitName)), baselineOpts, /*multifile*/ true, skipTypeBaselines, /*skipSymbolbaselines*/ true);
228228
});
229229

230230
// Ideally, a generated declaration file will have no errors. But we allow generated

0 commit comments

Comments
 (0)