diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-28 12:08:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-28 12:08:19 +0300 |
commit | 79659fe1fe45f2bdd13cd1a3980fbf1714caad57 (patch) | |
tree | 6dc2d9e7a3543d5346337c5056331c70f736e950 /spec/frontend_integration/test_helpers | |
parent | 6047d21a899cba25dfb554cca1776fed689dc951 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend_integration/test_helpers')
-rw-r--r-- | spec/frontend_integration/test_helpers/setup/setup_mock_server.js | 10 | ||||
-rw-r--r-- | spec/frontend_integration/test_helpers/setup/setup_testing_library.js | 14 |
2 files changed, 23 insertions, 1 deletions
diff --git a/spec/frontend_integration/test_helpers/setup/setup_mock_server.js b/spec/frontend_integration/test_helpers/setup/setup_mock_server.js index 43a21deed25..6f4832992a5 100644 --- a/spec/frontend_integration/test_helpers/setup/setup_mock_server.js +++ b/spec/frontend_integration/test_helpers/setup/setup_mock_server.js @@ -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; }); diff --git a/spec/frontend_integration/test_helpers/setup/setup_testing_library.js b/spec/frontend_integration/test_helpers/setup/setup_testing_library.js index 5081b1c3b62..adc59665306 100644 --- a/spec/frontend_integration/test_helpers/setup/setup_testing_library.js +++ b/spec/frontend_integration/test_helpers/setup/setup_testing_library.js @@ -1,3 +1,15 @@ 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; + }, +}); |