Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rn): Allow custom bundle command and Expo export:embed in xcode …
…wrap calls (#1723)
- Loading branch information
1 parent
4e55418
commit dc00980
Showing
10 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
tests/integration/_cases/react_native/xcode-wrap-call-bundle.trycmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
``` | ||
$ __SENTRY_RN_WRAP_XCODE_CALL=1 SENTRY_RN_REAL_NODE_BINARY=tests/integration/_fixtures/binary.sh SENTRY_RN_SOURCEMAP_REPORT=rn-sourcemap-report-bundle.json sentry-cli rn-cli.js bundle --sourcemap-output source.map.path --bundle-output source.path | ||
? success | ||
Binary executed with args: rn-cli.js bundle --sourcemap-output source.map.path --bundle-output source.path | ||
|
||
``` |
6 changes: 6 additions & 0 deletions
6
tests/integration/_cases/react_native/xcode-wrap-call-custom-bundle.trycmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
``` | ||
$ __SENTRY_RN_WRAP_XCODE_CALL=1 SENTRY_RN_REAL_NODE_BINARY=tests/integration/_fixtures/binary.sh SENTRY_RN_SOURCEMAP_REPORT=rn-sourcemap-report-custom-bundle.json SENTRY_RN_BUNDLE_COMMAND=custom sentry-cli rn-cli.js custom --sourcemap-output source.map.path --bundle-output source.path | ||
? success | ||
Binary executed with args: rn-cli.js custom --sourcemap-output source.map.path --bundle-output source.path | ||
|
||
``` |
6 changes: 6 additions & 0 deletions
6
tests/integration/_cases/react_native/xcode-wrap-call-expo-export.trycmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
``` | ||
$ __SENTRY_RN_WRAP_XCODE_CALL=1 SENTRY_RN_REAL_NODE_BINARY=tests/integration/_fixtures/binary.sh SENTRY_RN_SOURCEMAP_REPORT=rn-sourcemap-report-expo-export.json sentry-cli expo-cli.js export:embed --sourcemap-output source.map.path --bundle-output source.path | ||
? success | ||
Binary executed with args: expo-cli.js export:embed --sourcemap-output source.map.path --bundle-output source.path | ||
|
||
``` |
6 changes: 6 additions & 0 deletions
6
tests/integration/_cases/react_native/xcode-wrap-call-minimum.trycmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
``` | ||
$ __SENTRY_RN_WRAP_XCODE_CALL=1 SENTRY_RN_REAL_NODE_BINARY=tests/integration/_fixtures/binary.sh SENTRY_RN_SOURCEMAP_REPORT=rn-sourcemap-report-minimum.json sentry-cli first second | ||
? success | ||
Binary executed with args: first second | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
echo "Binary executed with args: $@" |
1 change: 1 addition & 0 deletions
1
tests/integration/_fixtures/react_native/empty-sourcemap-report.json.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"bundle_path":null,"sourcemap_path":null} |
1 change: 1 addition & 0 deletions
1
tests/integration/_fixtures/react_native/full-sourcemap-report.json.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"bundle_path":"source.path","sourcemap_path":"source.map.path"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#[cfg(target_os = "macos")] | ||
use crate::integration::register_test; | ||
|
||
#[test] | ||
#[cfg(target_os = "macos")] | ||
fn xcode_wrap_call_minimum() { | ||
register_test("react_native/xcode-wrap-call-minimum.trycmd"); | ||
assert_empty_sourcemap_report("rn-sourcemap-report-minimum.json"); | ||
clean_up("rn-sourcemap-report-minimum.json"); | ||
} | ||
|
||
#[test] | ||
#[cfg(target_os = "macos")] | ||
fn xcode_wrap_call_bundle() { | ||
register_test("react_native/xcode-wrap-call-bundle.trycmd"); | ||
assert_full_sourcemap_report("rn-sourcemap-report-bundle.json"); | ||
clean_up("rn-sourcemap-report-bundle.json"); | ||
} | ||
|
||
#[test] | ||
#[cfg(target_os = "macos")] | ||
fn xcode_wrap_call_custom_bundle() { | ||
register_test("react_native/xcode-wrap-call-custom-bundle.trycmd"); | ||
assert_full_sourcemap_report("rn-sourcemap-report-custom-bundle.json"); | ||
clean_up("rn-sourcemap-report-custom-bundle.json"); | ||
} | ||
|
||
#[test] | ||
#[cfg(target_os = "macos")] | ||
fn xcode_wrap_call_expo_export() { | ||
register_test("react_native/xcode-wrap-call-expo-export.trycmd"); | ||
assert_full_sourcemap_report("rn-sourcemap-report-expo-export.json"); | ||
clean_up("rn-sourcemap-report-expo-export.json"); | ||
} | ||
|
||
#[cfg(target_os = "macos")] | ||
fn clean_up(path: &str) { | ||
std::fs::remove_file(path).unwrap(); | ||
} | ||
|
||
#[cfg(target_os = "macos")] | ||
fn assert_full_sourcemap_report(actual: &str) { | ||
let actual_code = std::fs::read_to_string(actual).unwrap(); | ||
let expected_code = std::fs::read_to_string( | ||
"tests/integration/_fixtures/react_native/full-sourcemap-report.json.expected", | ||
) | ||
.unwrap(); | ||
|
||
assert_eq!(actual_code, expected_code); | ||
} | ||
|
||
#[cfg(target_os = "macos")] | ||
fn assert_empty_sourcemap_report(actual: &str) { | ||
let actual_code = std::fs::read_to_string(actual).unwrap(); | ||
let expected_code = std::fs::read_to_string( | ||
"tests/integration/_fixtures/react_native/empty-sourcemap-report.json.expected", | ||
) | ||
.unwrap(); | ||
|
||
assert_eq!(actual_code, expected_code); | ||
} |