I am writing integration tests against my db
and graphql
server.
jest
is my test runner and assertions library.
For each test, I validate that I don't have any errors:
const actual = await graphql(schema, query);
expect(actual.errors).toBeUndefined();
When my tests are failing (something goes wrong along the way),
the actual.errors
is not undefined
and I expect jest
to display the errors,
but this is what I get:
Expected value to be undefined, instead received
[[GraphQLError: Invalid value [object Object]]]
This error message is useless if I can't see what is the "invalid value".
How can I configure jest
so that it will print the error object?