@@ -191,3 +191,68 @@ test.describe("loader in an app", async () => {
191
191
) ;
192
192
} ) ;
193
193
} ) ;
194
+
195
+ test . describe ( "Development server" , async ( ) => {
196
+ let appFixture : AppFixture ;
197
+ let fixture : Fixture ;
198
+ let _consoleError : typeof console . error ;
199
+
200
+ test . beforeAll ( async ( ) => {
201
+ _consoleError = console . error ;
202
+ console . error = ( ) => { } ;
203
+
204
+ fixture = await createFixture (
205
+ {
206
+ future : {
207
+ v2_routeConvention : true ,
208
+ v2_errorBoundary : true ,
209
+ } ,
210
+ files : {
211
+ "app/routes/_index.jsx" : js `
212
+ import { Link } from "@remix-run/react";
213
+ export default () => <Link to="/child">Child</Link>;
214
+ ` ,
215
+ "app/routes/_main.jsx" : js `
216
+ import { useRouteError } from "@remix-run/react";
217
+ export function ErrorBoundary() {
218
+ return <pre>{useRouteError().message}</pre>;
219
+ }
220
+ ` ,
221
+ "app/routes/_main.child.jsx" : js `
222
+ export default function Component() {
223
+ throw new Error('Error from render')
224
+ }
225
+ ` ,
226
+ } ,
227
+ } ,
228
+ ServerMode . Development
229
+ ) ;
230
+ appFixture = await createAppFixture ( fixture , ServerMode . Development ) ;
231
+ } ) ;
232
+
233
+ test . afterAll ( ( ) => {
234
+ appFixture . close ( ) ;
235
+ console . error = _consoleError ;
236
+ } ) ;
237
+
238
+ test . describe ( "with JavaScript" , ( ) => {
239
+ runTests ( ) ;
240
+ } ) ;
241
+
242
+ test . describe ( "without JavaScript" , ( ) => {
243
+ test . use ( { javaScriptEnabled : false } ) ;
244
+ runTests ( ) ;
245
+ } ) ;
246
+
247
+ function runTests ( ) {
248
+ test ( "should not treat an ErrorBoundary-only route as a resource route" , async ( {
249
+ page,
250
+ } ) => {
251
+ let app = new PlaywrightFixture ( appFixture , page ) ;
252
+ await app . goto ( "/child" ) ;
253
+ let html = await app . getHtml ( ) ;
254
+ expect ( html ) . not . toMatch ( "has no component" ) ;
255
+ expect ( html ) . toMatch ( "Error from render" ) ;
256
+ } ) ;
257
+ }
258
+ } ) ;
0 commit comments