/
index.ts
28 lines (25 loc) · 1015 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// @ts-expect-error types are not defined for this internal import
import { configure } from '@testing-library/dom/dist/config';
import { addToElementCache } from '../serialize';
// @ts-expect-error types are not defined for this internal import
export * from '@testing-library/dom/dist/queries';
// @ts-expect-error types are not defined for this internal import
export { waitFor } from '@testing-library/dom/dist/wait-for';
export {
reviveElementsInString,
printElement,
addToElementCache,
} from '../serialize';
(configure as typeof import('@testing-library/dom').configure)({
getElementError(message, container) {
// Message is undefined sometimes, for example in the error message for "found multiple elements"
if (!message) {
return new Error(addToElementCache(container));
}
const error = new Error(message);
// @ts-expect-error container property is added by DTL
error.container = container;
error.name = 'TestingLibraryElementError';
return error;
},
});