Skip to content

Commit d01580e

Browse files
wip(tests): add more tests
1 parent 5061a06 commit d01580e

File tree

1 file changed

+62
-2
lines changed

1 file changed

+62
-2
lines changed

tests/basic.test.js

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,29 @@ test('nested with slot', async () => {
386386
});
387387

388388

389+
test.only('should handle missing dynamic import', async () => {
389390

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 () => {
391412
392413
const { page, output } = await createPage({
393414
files: {
@@ -416,9 +437,48 @@ test.only('should not hang', async () => {
416437
}
417438
});
418439
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 )
420479
421480
expect(output.filter(e => e.type === 'log').map(e => e.content).flat().join(',')).toBe('component,foo');
422481
423482
await page.close();
424483
});
484+
*/

0 commit comments

Comments
 (0)