File tree 1 file changed +13
-1
lines changed
packages/runtime-core/src
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,14 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) {
49
49
devtools . enabled = true
50
50
buffer . forEach ( ( { event, args } ) => devtools . emit ( event , ...args ) )
51
51
buffer = [ ]
52
- } else {
52
+ } else if (
53
+ // handle late devtools injection - only do this if we are in an actual
54
+ // browser environment to avoid the timer handle stalling test runner exit
55
+ // (#4815)
56
+ // eslint-disable-next-line no-restricted-globals
57
+ typeof window !== 'undefined' &&
58
+ ! navigator . userAgent . includes ( 'jsdom' )
59
+ ) {
53
60
const replay = ( target . __VUE_DEVTOOLS_HOOK_REPLAY__ =
54
61
target . __VUE_DEVTOOLS_HOOK_REPLAY__ || [ ] )
55
62
replay . push ( ( newHook : DevtoolsHook ) => {
@@ -59,10 +66,15 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) {
59
66
// at all, and keeping the buffer will cause memory leaks (#4738)
60
67
setTimeout ( ( ) => {
61
68
if ( ! devtools ) {
69
+ target . __VUE_DEVTOOLS_HOOK_REPLAY__ = null
62
70
devtoolsNotInstalled = true
63
71
buffer = [ ]
64
72
}
65
73
} , 3000 )
74
+ } else {
75
+ // non-browser env, assume not installed
76
+ devtoolsNotInstalled = true
77
+ buffer = [ ]
66
78
}
67
79
}
68
80
You can’t perform that action at this time.
0 commit comments