Quellcode durchsuchen

test: canonicalize Windows Vite fixture roots

Tianyi Cui vor 2 Wochen
Ursprung
Commit
00b2470eb6
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 8 2
      scripts/web-product-bundle-isolation.spec.ts

+ 8 - 2
scripts/web-product-bundle-isolation.spec.ts

@@ -25,7 +25,8 @@ const vite = createRequire(new URL('../apps/web/package.json', import.meta.url))
 }
 }
 
 
 function fixture() {
 function fixture() {
-  const root = realpathSync(mkdtempSync(join(tmpdir(), 'dsh-web-bundle-isolation-')))
+  // Vite resolves inputs with native realpath, which expands Windows short names.
+  const root = realpathSync.native(mkdtempSync(join(tmpdir(), 'dsh-web-bundle-isolation-')))
   const web = join(root, 'apps/web')
   const web = join(root, 'apps/web')
   const links: string[] = []
   const links: string[] = []
   onTestFinished(() => {
   onTestFinished(() => {
@@ -89,7 +90,12 @@ describe('default Web bundle input isolation', () => {
   })
   })
 
 
   it('allows experimental code in the separately emitted preview entry', async () => {
   it('allows experimental code in the separately emitted preview entry', async () => {
-    await expect(fixture().run()).resolves.toBeDefined()
+    await expect(fixture().run()).resolves.toMatchObject({
+      output: expect.arrayContaining([
+        expect.objectContaining({ type: 'asset', fileName: 'index.html' }),
+        expect.objectContaining({ type: 'chunk', name: 'bootstrap' }),
+      ]) as unknown,
+    })
   })
   })
 
 
   it.each([
   it.each([