Commit f6512ad6 authored by Paul Slaughter's avatar Paul Slaughter

Improve FE integration spec error logging

- The testing library logs are SO noisy.
  Let's trim it down a bit...
- Now the mock server console logs
  if a route bombs out.
parent 6f593b85
......@@ -7,6 +7,16 @@ beforeEach(() => {
const server = createMockServer();
server.logging = false;
server.pretender.handledRequest = (verb, path, { status, responseText }) => {
if (status >= 500) {
// eslint-disable-next-line no-console
console.log(`
The mock server returned status ${status} with "${verb} ${path}":
${JSON.stringify({ responseText }, null, 2)}
`);
}
};
global.mockServer = server;
});
import { configure } from '@testing-library/dom';
configure({ asyncUtilTimeout: 10000 });
const CUSTOM_ERROR_TYPE = 'TestingLibraryError';
configure({
asyncUtilTimeout: 10000,
// Overwrite default error message to reduce noise.
getElementError: (messageArg) => {
// Add to message because the `name` doesn't look like it's used (although it should).
const message = `${CUSTOM_ERROR_TYPE}:\n\n${messageArg}`;
const error = new Error(message);
error.name = CUSTOM_ERROR_TYPE;
return error;
},
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment