File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,9 @@ export async function renderServer(element: JSX.Element, options: RenderOptions
2222
2323 // Find rendered modules
2424 const modules = [ ...container . querySelectorAll < HTMLElement > ( selector ) ] ;
25- expect ( modules . length ) . toBeGreaterThan ( 0 ) ;
25+ if ( ! modules . length ) {
26+ throw new Error ( `renderServer: No modules found: ${ selector } ` ) ;
27+ }
2628
2729 return { container, element, modules } ;
2830}
@@ -39,13 +41,13 @@ export async function renderClient(element: JSX.Element, options: RenderOptions
3941
4042 // Find rendered modules
4143 const modules = [ ...container . querySelectorAll < HTMLElement > ( selector ) ] ;
42- expect ( modules . length ) . toBeGreaterThan ( 0 ) ;
44+ if ( ! modules . length ) {
45+ throw new Error ( `renderClient: No modules found: ${ selector } ` ) ;
46+ }
4347
4448 // Verify module initialisation
45- if ( moduleName ) {
46- for ( const $root of modules ) {
47- expect ( $root ) . toHaveAttribute ( `data-${ moduleName } -init` ) ;
48- }
49+ if ( moduleName && ! modules . every ( ( $root ) => $root . hasAttribute ( `data-${ moduleName } -init` ) ) ) {
50+ throw new Error ( `renderClient: Not all modules are initialised: ${ selector } ` ) ;
4951 }
5052
5153 return { container, element, modules } ;
You can’t perform that action at this time.
0 commit comments