@@ -74,32 +74,26 @@ function defineSyntaxErrorTests(f: Fixture) {
7474
7575 await expect ( page . getByTestId ( 'client-syntax-ready' ) ) . toBeVisible ( )
7676
77- // Set client state to verify it's preserved after client HMR
77+ // Set client state to verify preservation after HMR
7878 await page . getByTestId ( 'client-counter' ) . click ( )
7979 await expect ( page . getByTestId ( 'client-counter' ) ) . toHaveText (
8080 'Client Count: 1' ,
8181 )
8282
83- // Edit client file to introduce syntax error
83+ // Introduce syntax error and verify error overlay
8484 const editor = f . createEditor ( 'src/client.tsx' )
8585 editor . edit ( ( s ) =>
8686 s . replace (
8787 'export function TestSyntaxErrorClient() {' ,
8888 'export function TestSyntaxErrorClient() { const invalid = ;' ,
8989 ) ,
9090 )
91-
92- // Should see error overlay
9391 await expect ( page . locator ( 'vite-error-overlay' ) ) . toBeVisible ( )
9492
95- // Fix syntax error
93+ // Fix error and verify recovery with preserved client state
9694 editor . reset ( )
97-
98- // Error overlay should disappear and page should work
9995 await expect ( page . locator ( 'vite-error-overlay' ) ) . not . toBeVisible ( )
10096 await expect ( page . getByTestId ( 'client-syntax-ready' ) ) . toBeVisible ( )
101-
102- // Verify client state is preserved (no full reload happened)
10397 await expect ( page . getByTestId ( 'client-counter' ) ) . toHaveText (
10498 'Client Count: 1' ,
10599 )
@@ -110,32 +104,26 @@ function defineSyntaxErrorTests(f: Fixture) {
110104 await waitForHydration ( page )
111105 await using _ = await expectNoReload ( page )
112106
113- // Set client state to verify it's preserved after server HMR
107+ // Set client state to verify preservation during server HMR
114108 await page . getByTestId ( 'client-counter' ) . click ( )
115109 await expect ( page . getByTestId ( 'client-counter' ) ) . toHaveText (
116110 'Client Count: 1' ,
117111 )
118112
119- // Edit server file to introduce syntax error
113+ // Introduce server syntax error and verify error overlay
120114 const editor = f . createEditor ( 'src/server.tsx' )
121115 editor . edit ( ( s ) =>
122116 s . replace (
123117 'export function TestSyntaxErrorServer() {' ,
124118 'export function TestSyntaxErrorServer() { const invalid = ;' ,
125119 ) ,
126120 )
127-
128- // Should see error overlay
129121 await expect ( page . locator ( 'vite-error-overlay' ) ) . toBeVisible ( )
130122
131- // Fix syntax error
123+ // Fix error and verify recovery with preserved client state
132124 editor . reset ( )
133-
134- // Error overlay should disappear and server should work again
135125 await expect ( page . locator ( 'vite-error-overlay' ) ) . not . toBeVisible ( )
136126 await expect ( page . getByTestId ( 'server-syntax-ready' ) ) . toBeVisible ( )
137-
138- // Verify client state is preserved (no full reload happened)
139127 await expect ( page . getByTestId ( 'client-counter' ) ) . toHaveText (
140128 'Client Count: 1' ,
141129 )
@@ -144,30 +132,23 @@ function defineSyntaxErrorTests(f: Fixture) {
144132 test ( 'initial SSR with server component syntax error shows error page' , async ( {
145133 page,
146134 } ) => {
147- // Edit server file to introduce syntax error before navigation
135+ // Introduce server syntax error and navigate to page
148136 const editor = f . createEditor ( 'src/server.tsx' )
149137 editor . edit ( ( s ) =>
150138 s . replace (
151139 'export function TestSyntaxErrorServer() {' ,
152140 'export function TestSyntaxErrorServer() { const invalid = ;' ,
153141 ) ,
154142 )
155-
156- // Navigate to page with syntax error
157143 await page . goto ( f . url ( ) )
158-
159- // Should see error content
160144 await expect ( page . locator ( 'body' ) ) . toContainText (
161145 'Transform failed with 1 error' ,
162146 )
163147
164- // Fix syntax error
148+ // Fix error and verify recovery
165149 editor . reset ( )
166-
167- // Should work normally now - retry with more lenient approach
168150 await expect ( async ( ) => {
169151 await page . goto ( f . url ( ) )
170- // Check if we're still getting an error page
171152 const bodyText = await page . locator ( 'body' ) . textContent ( )
172153 if ( bodyText ?. includes ( 'Transform failed with 1 error' ) ) {
173154 throw new Error ( 'Still seeing error page' )
@@ -180,27 +161,21 @@ function defineSyntaxErrorTests(f: Fixture) {
180161 test ( 'initial SSR with client component syntax error shows error page' , async ( {
181162 page,
182163 } ) => {
183- // Edit client file to introduce syntax error before navigation
164+ // Introduce client syntax error and navigate to page
184165 const editor = f . createEditor ( 'src/client.tsx' )
185166 editor . edit ( ( s ) =>
186167 s . replace (
187168 'export function TestSyntaxErrorClient() {' ,
188169 'export function TestSyntaxErrorClient() { const invalid = ;' ,
189170 ) ,
190171 )
191-
192- // Navigate to page with syntax error
193172 await page . goto ( f . url ( ) )
194-
195- // Should see error content
196173 await expect ( page . locator ( 'body' ) ) . toContainText (
197174 'Transform failed with 1 error' ,
198175 )
199176
200- // Fix syntax error
177+ // Fix error and verify recovery
201178 editor . reset ( )
202-
203- // Should work normally now
204179 await expect ( async ( ) => {
205180 await page . goto ( f . url ( ) )
206181 await waitForHydration ( page )
0 commit comments