Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(react_native): Bubble up target_os #2240

Merged
merged 1 commit into from
Nov 8, 2024
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
1 change: 1 addition & 0 deletions tests/integration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod monitors;
mod org_tokens;
mod organizations;
mod projects;
#[cfg(target_os = "macos")]
mod react_native;
mod releases;
mod send_envelope;
Expand Down
13 changes: 0 additions & 13 deletions tests/integration/react_native/mod.rs
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
#[cfg(target_os = "macos")]
use crate::integration::register_test;

mod xcode;

#[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_packager_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_packager_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_packager_sourcemap_report("rn-sourcemap-report-expo-export.json");
clean_up("rn-sourcemap-report-expo-export.json");
}

#[test]
#[cfg(target_os = "macos")]
fn xcode_wrap_call_hermesc() {
register_test("react_native/xcode-wrap-call-hermesc.trycmd");
assert_sourcemap_report(
Expand All @@ -47,7 +41,6 @@ fn xcode_wrap_call_hermesc() {
}

#[test]
#[cfg(target_os = "macos")]
fn xcode_wrap_call_compose_source_maps() {
std::fs::copy("tests/integration/_fixtures/react_native/compose-source-maps-sourcemap-report.json.before.test","rn-sourcemap-report-compose-source-maps.json").unwrap();
register_test("react_native/xcode-wrap-call-compose-source-maps.trycmd");
Expand All @@ -59,7 +52,6 @@ fn xcode_wrap_call_compose_source_maps() {
}

#[test]
#[cfg(target_os = "macos")]
fn xcode_wrap_call_compose_source_maps_no_debug_id_copy() {
std::fs::copy("tests/integration/_fixtures/react_native/compose-source-maps-sourcemap-report.json.before.test","rn-sourcemap-report-compose-source-maps-no-debug-id-copy.json").unwrap();
register_test("react_native/xcode-wrap-call-compose-source-maps-no-debug-id-copy.trycmd");
Expand All @@ -71,7 +63,6 @@ fn xcode_wrap_call_compose_source_maps_no_debug_id_copy() {
}

#[test]
#[cfg(target_os = "macos")]
fn xcode_wrap_call_compose_source_maps_custom() {
register_test("react_native/xcode-wrap-call-compose-source-maps-custom.trycmd");
assert_sourcemap_report(
Expand All @@ -81,22 +72,18 @@ fn xcode_wrap_call_compose_source_maps_custom() {
clean_up("rn-sourcemap-report-compose-source-maps-custom.json");
}

#[cfg(target_os = "macos")]
fn clean_up(path: &str) {
std::fs::remove_file(path).unwrap();
}

#[cfg(target_os = "macos")]
fn assert_packager_sourcemap_report(actual: &str) {
assert_sourcemap_report("packager-sourcemap-report.json.expected", actual);
}

#[cfg(target_os = "macos")]
fn assert_empty_sourcemap_report(actual: &str) {
assert_sourcemap_report("empty-sourcemap-report.json.expected", actual);
}

#[cfg(target_os = "macos")]
fn assert_sourcemap_report(expected: &str, actual: &str) {
let actual_code = std::fs::read_to_string(actual).unwrap();
let expected_code =
Expand Down
6 changes: 0 additions & 6 deletions tests/integration/react_native/xcode.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
#[cfg(target_os = "macos")]
use crate::integration::register_test;
#[cfg(target_os = "macos")]
use crate::integration::{mock_common_upload_endpoints, ChunkOptions, ServerBehavior};
#[cfg(target_os = "macos")]
use mockito::Mock;

#[test]
#[cfg(target_os = "macos")]
fn xcode_upload_source_maps_missing_plist() {
let _upload_endpoints =
mock_common_upload_endpoints(ServerBehavior::Modern, ChunkOptions::default());
register_test("react_native/xcode-upload-source-maps-invalid-plist.trycmd");
}

#[test]
#[cfg(target_os = "macos")]
fn xcode_upload_source_maps_release_and_dist_from_env() {
let upload_endpoints =
mock_common_upload_endpoints(ServerBehavior::Modern, ChunkOptions::default());
register_test("react_native/xcode-upload-source-maps-release_and_dist_from_env.trycmd");
assert_endpoints(&upload_endpoints);
}

#[cfg(target_os = "macos")]
pub fn assert_endpoints(mocks: &[Mock]) {
for mock in mocks {
mock.assert();
Expand Down
Loading