File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 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 () => {
148148 ` )
149149} )
150150
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+
151176test ( 'should delegate to config.getElementError' , async ( ) => {
152177 const elementError = new Error ( 'Custom element error' )
153178 const getElementError = jest . fn ( ) . mockImplementation ( ( ) => elementError )
Original file line number Diff line number Diff line change @@ -24,10 +24,9 @@ function waitFor(
2424 stackTraceError,
2525 interval = 50 ,
2626 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+ } )
3130 return error
3231 } ,
3332 mutationObserverOptions = {
You can’t perform that action at this time.
0 commit comments