Skip to content

Commit b196712

Browse files
authored
chore: vite 5 test compatibility (#10896)
1 parent fb611ef commit b196712

File tree

5 files changed

+5
-12
lines changed

5 files changed

+5
-12
lines changed

packages/kit/test/apps/basics/src/routes/assets/+page.svelte

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/kit/test/apps/basics/src/routes/assets/logo.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/kit/test/apps/basics/test/server.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,13 @@ test.describe('Static files', () => {
539539
});
540540

541541
test('Vite serves assets in allowed directories', async ({ page, request }) => {
542-
await page.goto('/assets');
543-
const path = await page.textContent('h1');
542+
await page.goto('/asset-import');
543+
const path = await page.getAttribute('img[alt=potatoes]', 'src');
544544
if (!path) throw new Error('Could not determine path');
545545

546546
const r1 = await request.get(path);
547547
expect(r1.status()).toBe(200);
548-
expect(await r1.text()).toContain('http://www.w3.org/2000/svg');
548+
expect(await r1.text()).toBeTruthy();
549549

550550
// check that we can fetch a route which overlaps with the name of a file
551551
const r2 = await request.get('/package.json');

packages/kit/test/apps/basics/test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test.describe('Imports', () => {
2929
]);
3030
} else {
3131
expect(sources[0].startsWith('data:image/png;base64,')).toBeTruthy();
32-
expect(sources[1]).toBe(`${baseURL}/_app/immutable/assets/large.3183867c.jpg`);
32+
expect(sources[1]).toMatch(/\/_app\/immutable\/assets\/large\.[\w-]+\.jpg/);
3333
}
3434
});
3535
});

packages/kit/test/apps/options-2/test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test.describe('Service worker', () => {
5959
});
6060

6161
expect(self.base).toBe('/basepath');
62-
expect(self.build[0]).toMatch(/\/basepath\/_app\/immutable\/entry\/start\.[a-z0-9]+\.js/);
62+
expect(self.build[0]).toMatch(/\/basepath\/_app\/immutable\/entry\/start\.[\w-]+\.js/);
6363
});
6464

6565
test('does not register /basepath/service-worker.js', async ({ page }) => {

0 commit comments

Comments
 (0)