File tree 2 files changed +28
-4
lines changed
2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,31 @@ test('timeout logs a pretty DOM', async () => {
148
148
` )
149
149
} )
150
150
151
+ test ( "timeout doesn't error on DOMExceptions" , async ( ) => {
152
+ renderIntoDocument ( `<div id="pretty">how pretty</div>` )
153
+ const error = await waitFor (
154
+ ( ) => {
155
+ throw new DOMException ( 'nooooooo!' )
156
+ } ,
157
+ { timeout : 1 } ,
158
+ ) . catch ( e => e )
159
+ expect ( error . message ) . toMatchInlineSnapshot ( `
160
+ nooooooo!
161
+
162
+ Ignored nodes: comments, script, style
163
+ <html>
164
+ <head />
165
+ <body>
166
+ <div
167
+ id="pretty"
168
+ >
169
+ how pretty
170
+ </div>
171
+ </body>
172
+ </html>
173
+ ` )
174
+ } )
175
+
151
176
test ( 'should delegate to config.getElementError' , async ( ) => {
152
177
const elementError = new Error ( 'Custom element error' )
153
178
const getElementError = jest . fn ( ) . mockImplementation ( ( ) => elementError )
Original file line number Diff line number Diff line change @@ -24,10 +24,9 @@ function waitFor(
24
24
stackTraceError,
25
25
interval = 50 ,
26
26
onTimeout = error => {
27
- error . message = getConfig ( ) . getElementError (
28
- error . message ,
29
- container ,
30
- ) . message
27
+ Object . defineProperty ( error , 'message' , {
28
+ value : getConfig ( ) . getElementError ( error . message , container ) . message ,
29
+ } )
31
30
return error
32
31
} ,
33
32
mutationObserverOptions = {
You can’t perform that action at this time.
0 commit comments