Skip to content
Merged
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
2 changes: 1 addition & 1 deletion plugins/react-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// Example React Native path format (iOS):
// /var/containers/Bundle/Application/{DEVICE_ID}/HelloWorld.app/main.jsbundle

var PATH_STRIP_RE = /^.*\/[^\.]+\.app/;
var PATH_STRIP_RE = /^.*\/[^\.]+(\.app|CodePush)/;

var FATAL_ERROR_KEY = '--rn-fatal--';
var ASYNC_STORAGE_KEY = '--raven-js-global-error-payload--';
Expand Down
38 changes: 37 additions & 1 deletion test/plugins/react-native.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('React Native plugin', function () {
});

describe('_normalizeData()', function () {
it('should normalize culprit and frame filenames/URLs', function () {
it('should normalize culprit and frame filenames/URLs from app', function () {
var data = {
project: '2',
logger: 'javascript',
Expand Down Expand Up @@ -52,6 +52,42 @@ describe('React Native plugin', function () {
assert.equal(frames[0].filename, '/file1.js');
assert.equal(frames[1].filename, '/file2.js');
});

it('should normalize culprit and frame filenames/URLs from CodePush', function () {
var data = {
project: '2',
logger: 'javascript',
platform: 'javascript',

culprit: 'file:///var/mobile/Containers/Data/Application/ABC/Library/Application%20Support/CodePush/CDE/CodePush/app.js',
message: 'Error: crap',
exception: {
type: 'Error',
values: [{
stacktrace: {
frames: [{
filename: 'file:///var/mobile/Containers/Data/Application/ABC/Library/Application%20Support/CodePush/CDE/CodePush/file1.js',
lineno: 10,
colno: 11,
'function': 'broken'

}, {
filename: 'file:///var/mobile/Containers/Data/Application/ABC/Library/Application%20Support/CodePush/CDE/CodePush/file2.js',
lineno: 12,
colno: 13,
'function': 'lol'
}]
}
}],
}
};
reactNativePlugin._normalizeData(data);

assert.equal(data.culprit, '/app.js');
var frames = data.exception.values[0].stacktrace.frames;
assert.equal(frames[0].filename, '/file1.js');
assert.equal(frames[1].filename, '/file2.js');
});
});

describe('_transport()', function () {
Expand Down