Skip to content

Commit

Permalink
test(react_native): Bubble up target_os (#2240)
Browse files Browse the repository at this point in the history
We can just mark the entire module as macos-only
  • Loading branch information
szokeasaurusrex authored Nov 8, 2024
1 parent d678d2f commit 127de71
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
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

0 comments on commit 127de71

Please sign in to comment.