Commit 7a90a36c authored by Robert Knight's avatar Robert Knight

Fix occassionally slow frame-error-capture tests

These tests access the `error.stack` property, which in turn triggers the
`Error.prepareStackTrace` [1] handler installed by source-map-support [2]. This
is expensive and has caused some CI timeouts.

The workaround is to disable the `error.stack` processing for the duration of
these tests.

[1] https://v8.dev/docs/stack-trace-api#customizing-stack-traces
[2] https://github.com/evanw/node-source-map-support/blob/ac2c3e4c633c66931981ac94b44e6963addbe3f4/source-map-support.js#L584
parent 00d90b93
...@@ -28,7 +28,15 @@ describe('shared/frame-error-capture', () => { ...@@ -28,7 +28,15 @@ describe('shared/frame-error-capture', () => {
return stub; return stub;
} }
let origPrepareStackTrace;
beforeEach(() => { beforeEach(() => {
// Replace the `prepareStackTrace` handler installed by source-map-support
// for the duration of these tests, as they make accesses to the `error.stack`
// property much more expensive, which sometimes caused timeouts in CI.
origPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = undefined;
errorEvents = []; errorEvents = [];
window.addEventListener('message', handleMessage); window.addEventListener('message', handleMessage);
}); });
...@@ -36,6 +44,8 @@ describe('shared/frame-error-capture', () => { ...@@ -36,6 +44,8 @@ describe('shared/frame-error-capture', () => {
afterEach(() => { afterEach(() => {
window.removeEventListener('message', handleMessage); window.removeEventListener('message', handleMessage);
sendErrorsTo(null); sendErrorsTo(null);
Error.prepareStackTrace = origPrepareStackTrace;
}); });
describe('captureErrors', () => { describe('captureErrors', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment