@@ -6,7 +6,7 @@ import { addEventLogger } from './log-events'
6
6
import { createComponentStubs } from 'shared/stub-components'
7
7
import { throwError , warn , vueVersion } from 'shared/util'
8
8
import { compileTemplate } from 'shared/compile-template'
9
- import deleteMountingOptions from './delete-mounting -options'
9
+ import extractInstanceOptions from './extract-instance -options'
10
10
import createFunctionalComponent from './create-functional-component'
11
11
import { componentNeedsCompiling } from 'shared/validators'
12
12
import { validateSlots } from './validate-slots'
@@ -20,6 +20,18 @@ export default function createInstance (
20
20
// Remove cached constructor
21
21
delete component . _Ctor
22
22
23
+ // mounting options are vue-test-utils specific
24
+ //
25
+ // instance options are options that are passed to the
26
+ // root instance when it's instantiated
27
+ //
28
+ // component options are the root components options
29
+ const componentOptions = typeof component === 'function'
30
+ ? component . extendOptions
31
+ : component
32
+
33
+ const instanceOptions = extractInstanceOptions ( options )
34
+
23
35
if ( options . mocks ) {
24
36
addMocks ( options . mocks , _Vue )
25
37
}
@@ -40,12 +52,6 @@ export default function createInstance (
40
52
41
53
addEventLogger ( _Vue )
42
54
43
- const instanceOptions = {
44
- ...options
45
- }
46
-
47
- deleteMountingOptions ( instanceOptions )
48
-
49
55
const stubComponents = createComponentStubs (
50
56
// $FlowIgnore
51
57
component . components ,
@@ -67,9 +73,9 @@ export default function createInstance (
67
73
)
68
74
}
69
75
} )
70
- Object . keys ( component . components || { } ) . forEach ( c => {
76
+ Object . keys ( componentOptions . components || { } ) . forEach ( c => {
71
77
if (
72
- component . components [ c ] . extendOptions &&
78
+ componentOptions . components [ c ] . extendOptions &&
73
79
! instanceOptions . components [ c ]
74
80
) {
75
81
if ( options . logModifiedComponents ) {
@@ -82,7 +88,9 @@ export default function createInstance (
82
88
`option.`
83
89
)
84
90
}
85
- instanceOptions . components [ c ] = _Vue . extend ( component . components [ c ] )
91
+ instanceOptions . components [ c ] = _Vue . extend (
92
+ componentOptions . components [ c ]
93
+ )
86
94
}
87
95
} )
88
96
0 commit comments