mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
In particular for minified JavaScript, having easy access to the column number is crucial for debugging, and V8 already provides the column information for errors, we just removed it so far when we pretty printed the error stack. Before: https://imgur.com/Y6uDiUy.png After: https://imgur.com/0BWpQUD.png Fixed: chromium:1073064 Change-Id: I3e26115ed129139f6e57eb07fda179d495cc848a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3234177 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Auto-Submit: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Kateryna Prokopenko <kprokopenko@chromium.org>
43 lines
1.6 KiB
TypeScript
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:46)
|
|
at async async.js:3:21`;
|
|
});
|
|
});
|
|
});
|