Currently, I am working on integration tests for my db
and graphql
server using jest
as my test runner and assertions library.
During each test, I verify that there are no errors by checking:
const result = await graphql(schema, query);
expect(result.errors).toBeUndefined();
However, when a test fails due to an error, the result.errors
is not undefined
. Instead of displaying the error message, jest
shows:
Expected value to be undefined, instead received
[[GraphQLError: Invalid value [object Object]]]
This message does not provide enough information about what the actual "invalid value" is. How can I configure jest
to print the complete error object?