From 2cd9ebadcbadeea03e4601ddb09bfa671328b15e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 24 Oct 2018 13:03:29 -0700 Subject: [PATCH] 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. --- src/harness/fourslash.ts | 2 +- tests/cases/fourslash/generateTypes_baselines.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 081e5986051..58656b017db 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -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 { diff --git a/tests/cases/fourslash/generateTypes_baselines.ts b/tests/cases/fourslash/generateTypes_baselines.ts index a8363b30283..9508f83d31f 100644 --- a/tests/cases/fourslash/generateTypes_baselines.ts +++ b/tests/cases/fourslash/generateTypes_baselines.ts @@ -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", },