@@ -112,6 +112,25 @@ describe('attachErrorHandler', () => {
112112 // assert
113113 t . expect . errorToHaveBeenCaptured ( ) . withProps ( props ) ;
114114 } ) ;
115+
116+ test ( '`propsData` is added, if no options are provided to `attachErrorHandler`' , ( ) => {
117+ // arrange
118+ const props = { stubProp : 'stubData' } ;
119+ const t = testHarness ( {
120+ vm : {
121+ $props : props ,
122+ } ,
123+ optionsUndefined : true ,
124+ } ) ;
125+
126+ // act
127+ vi . useFakeTimers ( ) ;
128+ expect ( ( ) => t . run ( ) ) . toThrow ( DummyError ) ;
129+ vi . runAllTimers ( ) ;
130+
131+ // assert
132+ t . expect . errorToHaveBeenCaptured ( ) . withProps ( props ) ;
133+ } ) ;
115134 } ) ;
116135
117136 describe ( 'and `vm.$props` is defined' , ( ) => {
@@ -220,6 +239,7 @@ type TestHarnessOpts = {
220239 enableConsole ?: boolean ;
221240 silent ?: boolean ;
222241 attachProps ?: boolean ;
242+ optionsUndefined ?: boolean ;
223243} ;
224244
225245class DummyError extends Error {
@@ -236,6 +256,7 @@ const testHarness = ({
236256 enableErrorHandler,
237257 enableConsole,
238258 vm,
259+ optionsUndefined = false ,
239260} : TestHarnessOpts ) => {
240261 vi . useFakeTimers ( ) ;
241262 const providedErrorHandlerSpy = vi . fn ( ) ;
@@ -274,13 +295,15 @@ const testHarness = ({
274295 }
275296 /* eslint-enable no-global-assign */
276297
277- const options : Options = {
278- attachProps : ! ! attachProps ,
279- tracingOptions : { } ,
280- trackComponents : [ ] ,
281- timeout : 0 ,
282- hooks : [ ] as Operation [ ] ,
283- } ;
298+ const options : Options | undefined = optionsUndefined
299+ ? undefined
300+ : {
301+ attachProps : ! ! attachProps ,
302+ tracingOptions : { } ,
303+ trackComponents : [ ] ,
304+ timeout : 0 ,
305+ hooks : [ ] as Operation [ ] ,
306+ } ;
284307
285308 return {
286309 run : ( ) => {
0 commit comments