MCPcopy
hub / github.com/vitejs/vite / testStarExports

Function testStarExports

playground/hmr/__tests__/hmr.spec.ts:716–786  ·  playground/hmr/__tests__/hmr.spec.ts::testStarExports
(testDirName: string)

Source from the content-addressed store, hash-verified

714
715 describe(class="st">'indiscriminate imports: import *', () => {
716 const testStarExports = (testDirName: string) => {
717 const testDir = `${baseDir}/${testDirName}`
718
719 it(class="st">'accepts itself if all its exports are accepted', async () => {
720 const fileName = class="st">'deps-all-accepted.ts'
721 const file = `${testDir}/${fileName}`
722 const url = class="st">'/' + file
723
724 await untilBrowserLogAfter(
725 () => page.goto(`${viteTestUrl}/${testDir}/`),
726 [CONNECTED, class="st">'>>> ready <<<'],
727 (logs) => {
728 expect(logs).toContain(class="st">'loaded:all:a0b0c0default0')
729 expect(logs).toContain(class="st">'all >>>>>> a0, b0, c0')
730 },
731 )
732
733 await untilBrowserLogAfter(
734 () => {
735 editFile(file, (code) => code.replace(/([abc])0/g, class="st">'$11') + class="st">'\n')
736 },
737 HOT_UPDATED,
738 (logs) => {
739 expect(logs).toEqual([
740 class="st">'all >>>>>> a1, b1, c1',
741 `[vite] hot updated: ${url}`,
742 ])
743 },
744 )
745
746 await untilBrowserLogAfter(
747 () => {
748 editFile(file, (code) => code.replace(/([abc])1/g, class="st">'$12') + class="st">'\n')
749 },
750 HOT_UPDATED,
751 (logs) => {
752 expect(logs).toEqual([
753 class="st">'all >>>>>> a2, b2, c2',
754 `[vite] hot updated: ${url}`,
755 ])
756 },
757 )
758 })
759
760 it(class="st">"doesn't accept itself if one export is not accepted", async () => {
761 const fileName = class="st">'deps-some-accepted.ts'
762 const file = `${testDir}/${fileName}`
763
764 await untilBrowserLogAfter(
765 () => page.goto(`${viteTestUrl}/${testDir}/`),
766 [CONNECTED, class="st">'>>> ready <<<'],
767 (logs) => {
768 expect(logs).toContain(class="st">'loaded:some:a0b0c0default0')
769 expect(logs).toContain(class="st">'some >>>>>> a0, b0, c0')
770 },
771 )
772
773 await untilBrowserLogAfter(

Callers 1

hmr.spec.tsFile · 0.70

Calls 2

untilBrowserLogAfterFunction · 0.85
editFileFunction · 0.50

Tested by

no test coverage detected