Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/platform-tests-vercel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,26 @@ jobs:
with:
test-app-dir: packages/adapter-vercel/test/apps/basic
deployment-url: ${{ steps.deploy.outputs.deployment-url }}

test-split:
if: github.repository == 'sveltejs/kit'
runs-on: ubuntu-latest
timeout-minutes: 15
environment: '@sveltejs/adapter-vercel platform tests'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.sha || github.sha }}
persist-credentials: false

- uses: ./.github/actions/vercel-deploy
id: deploy
with:
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_SPLIT }}
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}

- uses: ./.github/actions/platform-test
with:
test-app-dir: packages/adapter-vercel/test/apps/split
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
3 changes: 2 additions & 1 deletion packages/adapter-vercel/test/apps/basic/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"skipLibCheck": true,
"sourceMap": true,
"moduleResolution": "bundler"
}
},
"include": ["src", "test", "playwright.config.js", "vite.config.ts"]
}
20 changes: 20 additions & 0 deletions packages/adapter-vercel/test/apps/split/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "test-vercel-split",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"preview": "vite preview",
"build": "vite build",
"prepare": "svelte-kit sync || echo ''",
"test:platform": "playwright test"
},
"devDependencies": {
"@sveltejs/kit": "workspace:*",
"@sveltejs/vite-plugin-svelte": "catalog:",
"svelte": "catalog:",
"typescript": "catalog:",
"vite": "catalog:"
},
"type": "module"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { config as default } from '../../utils.js';
13 changes: 13 additions & 0 deletions packages/adapter-vercel/test/apps/split/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
11 changes: 11 additions & 0 deletions packages/adapter-vercel/test/apps/split/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
let { children } = $props();
</script>

{@render children()}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1>Hello from SvelteKit on Vercel</h1>

<nav>
<a href="/a">go to route a</a>
</nav>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>This route will be served by a different function because we use the split config</p>
8 changes: 8 additions & 0 deletions packages/adapter-vercel/test/apps/split/test/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { expect, test } from '@playwright/test';

test('split functions work', async ({ page }) => {
await page.goto('/');
await expect(page.locator('h1')).toContainText('Hello from SvelteKit on Vercel');
await page.goto('/a');
await expect(page.locator('p')).toContainText(/split config/);
});
15 changes: 15 additions & 0 deletions packages/adapter-vercel/test/apps/split/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "$app/tsconfig",
"compilerOptions": {
"rewriteRelativeImportExtensions": true,
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"moduleResolution": "bundler"
},
"include": ["src", "test", "playwright.config.js", "vite.config.ts"]
}
13 changes: 13 additions & 0 deletions packages/adapter-vercel/test/apps/split/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import adapter from '../../../index.js';

export default defineConfig({
plugins: [
sveltekit({
adapter: adapter({
split: true
})
})
]
});
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading