summaryrefslogtreecommitdiff
path: root/spec/frontend_integration/test_helpers/setup/setup_testing_library.js
blob: adc59665306de036415378dd7a2dbb5e5381e9e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { configure } from '@testing-library/dom';

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;
  },
});