From 6671485596b68e0ee94529283f849bab9ecfad30 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 26 Oct 2017 13:48:59 -0700 Subject: [PATCH] Disable error sourcemaps during session test (#19504) * Disable error sourcemaps during session test * Also disable during the exceptions-specific test --- src/harness/unittests/session.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/harness/unittests/session.ts b/src/harness/unittests/session.ts index 74c5de2bbaf..3d9f782b2e0 100644 --- a/src/harness/unittests/session.ts +++ b/src/harness/unittests/session.ts @@ -53,6 +53,17 @@ namespace ts.server { return new TestSession(opts); } + // Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test + let oldPrepare: Function; + before(() => { + oldPrepare = (Error as any).prepareStackTrace; + delete (Error as any).prepareStackTrace; + }); + + after(() => { + (Error as any).prepareStackTrace = oldPrepare; + }); + beforeEach(() => { session = createSession(); session.send = (msg: protocol.Message) => { @@ -387,6 +398,18 @@ namespace ts.server { }); describe("exceptions", () => { + + // Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test + let oldPrepare: Function; + before(() => { + oldPrepare = (Error as any).prepareStackTrace; + delete (Error as any).prepareStackTrace; + }); + + after(() => { + (Error as any).prepareStackTrace = oldPrepare; + }); + const command = "testhandler"; class TestSession extends Session { lastSent: protocol.Message;