Skip to content

Commit 0db3038

Browse files
authored
Fix tests for node 11 (#28108)
1. Sort is now stable in node 11, which exposed a lack in the sorting of nested ranges. Ranges now sort based on last ending if the start positions are the same. This means nested ranges sort the containing range first, even if a range contains another range that starts at the same position. 2. Symbol has a new member description which can't be accessed through the prototype. In addition, Array now has flat and flatMap, which I excluded to keep baselines the same between Node 6-11.
1 parent ff6f947 commit 0db3038

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/harness/fourslash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3846,7 +3846,7 @@ ${code}
38463846
}
38473847

38483848
// put ranges in the correct order
3849-
localRanges = localRanges.sort((a, b) => a.pos < b.pos ? -1 : 1);
3849+
localRanges = localRanges.sort((a, b) => a.pos < b.pos ? -1 : a.pos === b.pos && a.end > b.end ? -1 : 1);
38503850
localRanges.forEach((r) => { ranges.push(r); });
38513851

38523852
return {

tests/cases/fourslash/generateTypes_baselines.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ verify.generateTypes(
66
// would like to test against the real "global" but that may vary between node versions.
77
{
88
value: {
9-
Array: ignore(Array, ["values"]),
9+
Array: ignore(Array, ["values", "flat", "flatMap"]),
1010
Boolean,
1111
Date,
1212
Math,
1313
Number,
1414
RegExp,
1515
String: ignore(String, ["padStart", "padEnd", "trimStart", "trimEnd"]),
16-
Symbol: ignore(Symbol, ["asyncIterator"]),
16+
Symbol: ignore(Symbol, ["asyncIterator", "description"]),
1717
},
1818
outputBaseline: "global",
1919
},

0 commit comments

Comments
 (0)