Skip to content

Commit

Permalink
Improve test fixture output for errors in throwOnFieldError transforms
Browse files Browse the repository at this point in the history
Reviewed By: evanyeung

Differential Revision: D65447769

fbshipit-source-id: b0f5a8014c4d1ae7d7635b4fcab9f78eb463132e
  • Loading branch information
captbaritone authored and facebook-github-bot committed Nov 5, 2024
1 parent 8421851 commit 8f93027
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use fixture_tests::Fixture;
use graphql_ir::build;
use graphql_ir::ExecutableDefinition;
use graphql_syntax::parse_executable;
use graphql_test_helpers::diagnostics_to_sorted_string;
use relay_codegen::print_fragment;
use relay_codegen::print_operation;
use relay_config::ProjectConfig;
Expand Down Expand Up @@ -69,11 +70,5 @@ pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result<String, String>
.collect::<Vec<_>>()
.join("\n\n")
})
.map_err(|errors| {
errors
.into_iter()
.map(|error| format!("{:?}", error))
.collect::<Vec<_>>()
.join("\n\n")
})
.map_err(|diagnostics| diagnostics_to_sorted_string(fixture.content, &diagnostics))
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ mutation MyMutation @throwOnFieldError {
}
}
==================================== ERROR ====================================
Diagnostic(DiagnosticData { message: InvalidDirectiveUsageUnsupportedLocation { directive_name: DirectiveName("throwOnFieldError"), valid_locations: "QUERY, FRAGMENT_DEFINITION" }, location: throw_on_field_error_mutation_directive.graphql:42:59, related_information: [], tags: [], severity: Error, data: [], machine_readable: {} })
✖︎ Directive 'throwOnFieldError' not supported in this location. Supported location(s): QUERY, FRAGMENT_DEFINITION

throw_on_field_error_mutation_directive.graphql:3:22
2 │
3 │ mutation MyMutation @throwOnFieldError {
│ ^^^^^^^^^^^^^^^^^
4 │ setName(name: "Alice") {

0 comments on commit 8f93027

Please sign in to comment.