Skip to content

Commit

Permalink
Fix tests for node 11 (#28108)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sandersn committed Oct 24, 2018
1 parent ca6e2e7 commit 2cd9eba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/harness/fourslash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3867,7 +3867,7 @@ ${code}
}

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

return {
Expand Down
4 changes: 2 additions & 2 deletions tests/cases/fourslash/generateTypes_baselines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ verify.generateTypes(
// would like to test against the real "global" but that may vary between node versions.
{
value: {
Array: ignore(Array, ["values"]),
Array: ignore(Array, ["values", "flat", "flatMap"]),
Boolean,
Date,
Math,
Number,
RegExp,
String: ignore(String, ["padStart", "padEnd", "trimStart", "trimEnd"]),
Symbol: ignore(Symbol, ["asyncIterator"]),
Symbol: ignore(Symbol, ["asyncIterator", "description"]),
},
outputBaseline: "global",
},
Expand Down

0 comments on commit 2cd9eba

Please sign in to comment.