@@ -386,8 +386,29 @@ test('nested with slot', async () => {
386
386
} ) ;
387
387
388
388
389
+ test . only ( 'should handle missing dynamic import' , async ( ) => {
389
390
390
- test . only ( 'should not hang' , async ( ) => {
391
+ const { page, output } = await createPage ( {
392
+ files : {
393
+ ...defaultFiles ,
394
+ '/component.vue' : `
395
+ <script>
396
+ import('./missing_file.js')
397
+ .catch(ex => console.log('error'))
398
+ .finally(() => console.log('done'))
399
+ </script>
400
+ ` ,
401
+ }
402
+ } ) ;
403
+
404
+ expect ( output . filter ( e => e . type === 'log' ) . map ( e => e . content ) . flat ( ) . join ( ',' ) ) . toBe ( 'error,done' ) ;
405
+
406
+ await page . close ( ) ;
407
+ } ) ;
408
+
409
+
410
+ /*
411
+ xtest('should not hang on cycles', async () => {
391
412
392
413
const { page, output } = await createPage({
393
414
files: {
@@ -416,9 +437,48 @@ test.only('should not hang', async () => {
416
437
}
417
438
});
418
439
419
- await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
440
+ expect(output.filter(e => e.type === 'log').map(e => e.content).flat().join(',')).toBe('component,foo');
441
+
442
+ await page.close();
443
+ });
444
+
445
+
446
+
447
+ xtest('should handle cycles', async () => {
448
+
449
+ const { page, output } = await createPage({
450
+ files: {
451
+ ...defaultFiles,
452
+ '/component.vue': `
453
+ <script>
454
+ import bar from '/foo.vue';
455
+
456
+ console.log('component', bar);
457
+
458
+ export default {
459
+ name: 'component',
460
+ }
461
+ </script>
462
+ `,
463
+
464
+ '/foo.vue': `
465
+ <script>
466
+ import component from '/component.vue';
467
+
468
+ console.log('foo', component);
469
+
470
+ export default {
471
+ name: 'foo',
472
+ }
473
+ </script>
474
+ `,
475
+ }
476
+ });
477
+
478
+ console.log( output )
420
479
421
480
expect(output.filter(e => e.type === 'log').map(e => e.content).flat().join(',')).toBe('component,foo');
422
481
423
482
await page.close();
424
483
});
484
+ */
0 commit comments