@@ -3,7 +3,8 @@ import ComponentWithInject from '~resources/components/component-with-inject.vue
3
3
import { injectSupported } from '~resources/utils'
4
4
import {
5
5
describeWithMountingMethods ,
6
- itDoNotRunIf
6
+ itDoNotRunIf ,
7
+ itSkipIf
7
8
} from '~resources/utils'
8
9
9
10
describeWithMountingMethods ( 'options.provide' , ( mountingMethod ) => {
@@ -57,16 +58,20 @@ describeWithMountingMethods('options.provide', (mountingMethod) => {
57
58
expect ( wrapper . vm . setInBeforeCreate ) . to . equal ( 'created' )
58
59
} )
59
60
60
- itDoNotRunIf ( ! injectSupported ( ) , 'injects the provide from the config' , ( ) => {
61
- config . provide [ 'fromMount' ] = 'globalConfig'
61
+ itSkipIf ( mountingMethod . name === 'renderToString' ,
62
+ 'injects the provide from the config' , ( ) => {
63
+ if ( ! injectSupported ( ) ) {
64
+ return
65
+ }
66
+ config . provide [ 'fromMount' ] = 'globalConfig'
62
67
63
- const wrapper = mountingMethod ( ComponentWithInject )
64
- const HTML = mountingMethod . name === 'renderToString'
65
- ? wrapper
66
- : wrapper . html ( )
68
+ const wrapper = mountingMethod ( ComponentWithInject )
69
+ const HTML = mountingMethod . name === 'renderToString'
70
+ ? wrapper
71
+ : wrapper . html ( )
67
72
68
- expect ( HTML ) . to . contain ( 'globalConfig' )
69
- } )
73
+ expect ( HTML ) . to . contain ( 'globalConfig' )
74
+ } )
70
75
71
76
itDoNotRunIf ( ! injectSupported ( ) , 'prioritize mounting options over config' , ( ) => {
72
77
config . provide [ 'fromMount' ] = 'globalConfig'
@@ -81,13 +86,14 @@ describeWithMountingMethods('options.provide', (mountingMethod) => {
81
86
expect ( HTML ) . to . contain ( '_' )
82
87
} )
83
88
84
- itDoNotRunIf ( ! injectSupported ( ) , 'config with function throws' , ( ) => {
85
- config . provide = ( ) => { }
89
+ itSkipIf ( mountingMethod . name === 'renderToString' ,
90
+ 'config with function throws' , ( ) => {
91
+ config . provide = ( ) => { }
86
92
87
- expect ( ( ) => {
88
- mountingMethod ( ComponentWithInject , {
89
- provide : { fromMount : '_' }
90
- } )
91
- } ) . to . throw ( )
92
- } )
93
+ expect ( ( ) => {
94
+ mountingMethod ( ComponentWithInject , {
95
+ provide : { fromMount : '_' }
96
+ } )
97
+ } ) . to . throw ( )
98
+ } )
93
99
} )
0 commit comments