@@ -59,6 +59,7 @@ export interface RuntimeTest<Props extends Record<string, any> = Record<string,
59
59
} ;
60
60
logs : any [ ] ;
61
61
warnings : any [ ] ;
62
+ hydrate : Function ;
62
63
} ) => void | Promise < void > ;
63
64
test_ssr ?: ( args : { assert : Assert } ) => void | Promise < void > ;
64
65
accessors ?: boolean ;
@@ -103,6 +104,10 @@ export function runtime_suite(runes: boolean) {
103
104
if ( config . skip_mode ?. includes ( 'hydrate' ) ) return true ;
104
105
}
105
106
107
+ if ( variant === 'dom' && config . skip_mode ?. includes ( 'client' ) ) {
108
+ return 'no-test' ;
109
+ }
110
+
106
111
if ( variant === 'ssr' ) {
107
112
if (
108
113
( config . mode && ! config . mode . includes ( 'server' ) ) ||
@@ -161,6 +166,7 @@ async function run_test_variant(
161
166
162
167
let logs : string [ ] = [ ] ;
163
168
let warnings : string [ ] = [ ] ;
169
+ let manual_hydrate = false ;
164
170
165
171
{
166
172
// use some crude static analysis to determine if logs/warnings are intercepted.
@@ -180,6 +186,10 @@ async function run_test_variant(
180
186
console . log = ( ...args ) => logs . push ( ...args ) ;
181
187
}
182
188
189
+ if ( str . slice ( 0 , i ) . includes ( 'hydrate' ) ) {
190
+ manual_hydrate = true ;
191
+ }
192
+
183
193
if ( str . slice ( 0 , i ) . includes ( 'warnings' ) || config . warnings ) {
184
194
// eslint-disable-next-line no-console
185
195
console . warn = ( ...args ) => {
@@ -297,17 +307,30 @@ async function run_test_variant(
297
307
298
308
let instance : any ;
299
309
let props : any ;
310
+ let hydrate_fn : Function = ( ) => {
311
+ throw new Error ( 'Ensure dom mode is skipped' ) ;
312
+ } ;
300
313
301
314
if ( runes ) {
302
315
props = proxy ( { ...( config . props || { } ) } ) ;
303
-
304
- const render = variant === 'hydrate' ? hydrate : mount ;
305
- instance = render ( mod . default , {
306
- target,
307
- props,
308
- intro : config . intro ,
309
- recover : config . recover ?? false
310
- } ) ;
316
+ if ( manual_hydrate ) {
317
+ hydrate_fn = ( ) => {
318
+ instance = hydrate ( mod . default , {
319
+ target,
320
+ props,
321
+ intro : config . intro ,
322
+ recover : config . recover ?? false
323
+ } ) ;
324
+ } ;
325
+ } else {
326
+ const render = variant === 'hydrate' ? hydrate : mount ;
327
+ instance = render ( mod . default , {
328
+ target,
329
+ props,
330
+ intro : config . intro ,
331
+ recover : config . recover ?? false
332
+ } ) ;
333
+ }
311
334
} else {
312
335
instance = createClassComponent ( {
313
336
component : mod . default ,
@@ -357,7 +380,8 @@ async function run_test_variant(
357
380
raf,
358
381
compileOptions,
359
382
logs,
360
- warnings
383
+ warnings,
384
+ hydrate : hydrate_fn
361
385
} ) ;
362
386
}
363
387
0 commit comments