Skip to content

Commit 6671485

Browse files
authored
Disable error sourcemaps during session test (#19504)
* Disable error sourcemaps during session test * Also disable during the exceptions-specific test
1 parent 940175e commit 6671485

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/harness/unittests/session.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ namespace ts.server {
5353
return new TestSession(opts);
5454
}
5555

56+
// 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
57+
let oldPrepare: Function;
58+
before(() => {
59+
oldPrepare = (Error as any).prepareStackTrace;
60+
delete (Error as any).prepareStackTrace;
61+
});
62+
63+
after(() => {
64+
(Error as any).prepareStackTrace = oldPrepare;
65+
});
66+
5667
beforeEach(() => {
5768
session = createSession();
5869
session.send = (msg: protocol.Message) => {
@@ -387,6 +398,18 @@ namespace ts.server {
387398
});
388399

389400
describe("exceptions", () => {
401+
402+
// 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
403+
let oldPrepare: Function;
404+
before(() => {
405+
oldPrepare = (Error as any).prepareStackTrace;
406+
delete (Error as any).prepareStackTrace;
407+
});
408+
409+
after(() => {
410+
(Error as any).prepareStackTrace = oldPrepare;
411+
});
412+
390413
const command = "testhandler";
391414
class TestSession extends Session {
392415
lastSent: protocol.Message;

0 commit comments

Comments
 (0)