From 94fb7e8dfc045b292b4cf98c4618196b27cbb292 Mon Sep 17 00:00:00 2001 From: Alison Winters Date: Wed, 28 Feb 2024 18:37:44 +0800 Subject: [PATCH] un-mangle the typescript so assert output is more readable --- test/Framework/BlackBox.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/Framework/BlackBox.ts b/test/Framework/BlackBox.ts index bd8b3d5..304e6d3 100644 --- a/test/Framework/BlackBox.ts +++ b/test/Framework/BlackBox.ts @@ -94,6 +94,17 @@ const extractInfo = (originalText: string) => { }; }; +export const toJs = (s: Selection) => ({ + active: { + line: s.active.line, + character: s.active.character, + }, + anchor: { + line: s.anchor.line, + character: s.anchor.character, + }, +}); + const reusableDocuments: Map = new Map(); export const run = (testCase: TestCase, before?: (textEditor: TextEditor) => void) => { @@ -138,7 +149,7 @@ export const run = (testCase: TestCase, before?: (textEditor: TextEditor) => voi try { assert.equal(TestUtil.getDocument()!.getText(), toInfo.cleanText); - assert.deepEqual(TestUtil.getSelections(), toInfo.selections); + assert.deepEqual(TestUtil.getSelections().map(toJs), toInfo.selections.map(toJs)); } catch (error) { done(error); return;