Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/metro-symbolicate/src/Symbolication.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@ class SymbolicationContext<ModuleIdsT> {
// IOS: foo@123.js:4:18131, Android: bar:123.js:4:18063
// sample stack trace without function name:
// 123.js:4:18131
// sample stack trace with a Windows absolute path:
// foo@C:\app\123.js:4:18131
// sample result:
// IOS: foo.js:57:foo, Android: bar.js:75:bar
symbolicate(stackTrace: string): string {
return stackTrace.replace(
/(?:([^@: \n(]+)(@|:))?(?:(?:([^@: \n(]+):)?(\d+):(\d+)|\[native code\])/g,
/(?:((?:[A-Za-z]:\\)?[^@: \n(]+)(@|:))?(?:(?:((?:[A-Za-z]:\\)?[^@: \n(]+):)?(\d+):(\d+)|\[native code\])/g,
(match, func, delimiter, fileName, line, column) => {
if (delimiter === ':' && func && !fileName) {
fileName = func;
Expand Down
12 changes: 12 additions & 0 deletions packages/metro-symbolicate/src/__tests__/symbolicate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,18 @@ test('symbolicating a stack trace', async () =>
execute([TESTFILE_MAP], read('testfile.stack')),
).resolves.toMatchSnapshot());

test('symbolicating a stack trace with Windows absolute paths', async () => {
const stack = read('testfile.stack');
const windowsStack = stack.replaceAll(
/(^|@)(thrower\.min\.js)/gm,
'$1C:\\app\\$2',
);
expect(windowsStack).not.toEqual(stack);
expect(await execute([TESTFILE_MAP], windowsStack)).toEqual(
await execute([TESTFILE_MAP], stack),
);
});

test('symbolicating a stack trace in Node format', async () =>
await expect(
execute([TESTFILE_MAP], read('testfile.node.stack')),
Expand Down
4 changes: 0 additions & 4 deletions scripts/jestFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ const SKIPPED_ON_WINDOWS = [
// flow-api-translator emits os.EOL line endings in generated comments.
// Snapshots are generated and verified on posix only.
'scripts/__tests__/api-snapshots-sync-test.js',

// TODO: Windows product bugs
// Stack trace parsing does not support drive letters
'packages/metro-symbolicate/src/__tests__/symbolicate-test.js',
];

const SKIPPED_PATHS = process.platform === 'win32' ? SKIPPED_ON_WINDOWS : [];
Expand Down
Loading