Files
react-native-devtools-frontend/test/e2e/console/console-error-stack_test.ts
T
Benedikt Meurer aef3b59541 [console] Correctly symbolize stack traces with async frames.
This is a pragmatic fix for the issue. It adds an E2E test to
specifically test for the relevant case. We clearly need to refactor
this logic in the future.

Fixed: chromium:1189091
Change-Id: I9f2a4937bb49435137568fcf7a634b36f61fa033
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2767267
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2021-03-17 17:01:26 +00:00

43 lines
1.6 KiB
TypeScript

// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {goToResource, waitForFunction} from '../../shared/helper.js';
import {describe, it} from '../../shared/mocha-extensions.js';
import {getStructuredConsoleMessages, navigateToConsoleTab, showVerboseMessages} from '../helpers/console-helpers.js';
/* eslint-disable no-console */
describe('The Console\'s error stack formatting', () => {
it('picks up custom exception names ending with \'Error\' and symbolizes stack traces according to source maps',
async () => {
await goToResource('sources/error-with-sourcemap.html');
await navigateToConsoleTab();
await showVerboseMessages();
await waitForFunction(async () => {
const messages = await getStructuredConsoleMessages();
if (messages.length !== 1) {
return false;
}
const [{message}] = messages;
return /^MyError.*error-with-sourcemap.ts:6/.test(message.replace('\n', ''));
});
});
it('correctly symbolizes stack traces with async frames for anonymous functions', async () => {
await goToResource('console/error-with-async-frame.html');
await navigateToConsoleTab();
await showVerboseMessages();
await waitForFunction(async () => {
const messages = await getStructuredConsoleMessages();
if (messages.length !== 1) {
return false;
}
const [{message}] = messages;
return message === `Error
at foo (async.js:2)
at async async.js:3`;
});
});
});