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
67 changes: 36 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ jobs:
- run: pnpm run sync-all
- run: pnpm ${{ matrix.script }}
e2e:
# every Playwright leg; `script` is a root package.json script, see test/utils.js for the env
# every Playwright leg. `script` runs in the `app`s named, or in packages/kit without `app`;
# see test/utils.js for the env. pnpm skips a named app that lacks `script` as long as
# another has it, so check each app defines the script
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
timeout-minutes: 30
strategy:
Expand All @@ -80,42 +82,42 @@ jobs:
include:
# basics is the biggest app: its js project is sharded and its no-js project runs
# alone; the other apps boot once in the `rest` legs
- { script: 'test:kit:dev:basics', project: 'js', shard: '1/2' }
- { script: 'test:kit:dev:basics', project: 'js', shard: '2/2' }
- { script: 'test:kit:dev:basics', project: 'no-js' }
- { script: 'test:kit:dev:rest', workers: 2 }
- { script: 'test:kit:build:basics', project: 'js', shard: '1/2' }
- { script: 'test:kit:build:basics', project: 'js', shard: '2/2' }
- { script: 'test:kit:build:basics', project: 'no-js' }
- { script: 'test:kit:build:rest', workers: 2 }
# basics again with SVELTE_ASYNC=true
- { script: 'test:svelte-async:dev', project: 'js', shard: '1/2' }
- { script: 'test:svelte-async:dev', project: 'js', shard: '2/2' }
- { script: 'test:svelte-async:dev', project: 'no-js' }
- { script: 'test:svelte-async:build', project: 'js', shard: '1/2' }
- { script: 'test:svelte-async:build', project: 'js', shard: '2/2' }
- { script: 'test:svelte-async:build', project: 'no-js' }
# basics and options with ROUTER_RESOLUTION=server
- { script: 'test:server-side-route-resolution:dev', project: 'js', shard: '1/2' }
- { script: 'test:server-side-route-resolution:dev', project: 'js', shard: '2/2' }
- { script: 'test:server-side-route-resolution:dev', project: 'no-js' }
- { script: 'test:server-side-route-resolution:build', project: 'js', shard: '1/2' }
- { script: 'test:server-side-route-resolution:build', project: 'js', shard: '2/2' }
- { script: 'test:server-side-route-resolution:build', project: 'no-js' }
- { app: basics, script: pw:dev, project: js, shard: 1/2 }
- { app: basics, script: pw:dev, project: js, shard: 2/2 }
- { app: basics, script: pw:dev, project: no-js }
- { script: test:dev:rest, workers: 2 }
- { app: basics, script: pw:build, project: js, shard: 1/2 }
- { app: basics, script: pw:build, project: js, shard: 2/2 }
- { app: basics, script: pw:build, project: no-js }
- { script: test:build:rest, workers: 2 }
# the server config variants each app declares in its playwright.config.js
- { app: basics, script: pw:dev, variant: async, project: js, shard: 1/2 }
- { app: basics, script: pw:dev, variant: async, project: js, shard: 2/2 }
- { app: basics, script: pw:dev, variant: async, project: no-js }
- { app: basics, script: pw:build, variant: async, project: js, shard: 1/2 }
- { app: basics, script: pw:build, variant: async, project: js, shard: 2/2 }
- { app: basics, script: pw:build, variant: async, project: no-js }
- { app: basics options, script: pw:dev, variant: resolution, project: js, shard: 1/2 }
- { app: basics options, script: pw:dev, variant: resolution, project: js, shard: 2/2 }
- { app: basics options, script: pw:dev, variant: resolution, project: no-js }
- { app: basics options, script: pw:build, variant: resolution, project: js, shard: 1/2 }
- { app: basics options, script: pw:build, variant: resolution, project: js, shard: 2/2 }
- { app: basics options, script: pw:build, variant: resolution, project: no-js }
# the cross-platform subset of basics on the other browsers and operating systems
- { script: 'test:cross-platform:dev', os: windows-latest, workers: 2 }
- { script: 'test:cross-platform:build', os: windows-latest, workers: 2 }
- { script: 'test:cross-platform:dev', browser: firefox }
- { script: 'test:cross-platform:build', browser: firefox }
- { script: 'test:cross-platform:dev', os: macOS-latest, browser: webkit, workers: 3 }
- { script: 'test:cross-platform:build', os: macOS-latest, browser: webkit, workers: 3 }
- { script: test:cross-platform:dev, os: windows-latest, workers: 2 }
- { script: test:cross-platform:build, os: windows-latest, workers: 2 }
- { script: test:cross-platform:dev, browser: firefox }
- { script: test:cross-platform:build, browser: firefox }
- { script: test:cross-platform:dev, os: macOS-latest, browser: webkit, workers: 3 }
- { script: test:cross-platform:build, os: macOS-latest, browser: webkit, workers: 3 }
# `vite` swaps in a pnpm-workspace.yaml catalog, e.g. to test a beta
# - { script: 'test:kit:dev:basics', vite: 'beta' }
# - { app: basics, script: pw:dev, vite: 'beta' }
env:
KIT_E2E_BROWSER: ${{ matrix.browser || 'chromium' }}
KIT_E2E_WORKERS: ${{ matrix.workers || 4 }}
KIT_E2E_SHARD: ${{ matrix.shard }}
KIT_E2E_PROJECT: ${{ matrix.project }}
KIT_E2E_VARIANT: ${{ matrix.variant }}
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -135,7 +137,10 @@ jobs:
os: ${{ matrix.os || 'ubuntu-latest' }}
e2e-browser: ${{ matrix.browser }}
- run: pnpm run sync-all
- run: pnpm ${{ matrix.script }}
- shell: bash
run: |
for app in ${{ matrix.app }}; do filter="$filter --filter=test-$app"; done
pnpm --dir packages/kit --workspace-concurrency=1 $filter ${{ matrix.script }}
- name: Print flaky test report
run: node scripts/print-flaky-test-report.js
- name: Archive test results
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ KIT_E2E_WORKERS=undefined
KIT_E2E_RETRIES=2 pnpm test:kit
```

`KIT_E2E_VARIANT` selects one of the server configuration variants a test app declares in its `playwright.config.js`, e.g. `KIT_E2E_VARIANT=async pnpm -F test-basics pw:dev`.

## Working on Vite and other dependencies

If you would like to test local changes to Vite or another dependency, you can build it and then use [`pnpm.overrides`](https://pnpm.io/package_json#pnpmoverrides). Please note that `pnpm.overrides` must be specified in the root `package.json` and you must first list the package as a dependency in the root `package.json`:
Expand Down
10 changes: 0 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
"test:kit:unit": "cd packages/kit && vitest run -c vitest.kit.config.js",
"test:kit:dev": "pnpm run --dir packages/kit test:dev",
"test:kit:build": "pnpm run --dir packages/kit test:build",
"test:kit:dev:basics": "pnpm run --dir packages/kit test:dev:basics",
"test:kit:dev:rest": "pnpm run --dir packages/kit test:dev:rest",
"test:kit:build:basics": "pnpm run --dir packages/kit test:build:basics",
"test:kit:build:rest": "pnpm run --dir packages/kit test:build:rest",
"test:cross-platform:dev": "pnpm run --dir packages/kit test:cross-platform:dev",
"test:cross-platform:build": "pnpm run --dir packages/kit test:cross-platform:build",
"test:server-side-route-resolution:dev": "pnpm run --dir packages/kit test:server-side-route-resolution:dev",
"test:server-side-route-resolution:build": "pnpm run --dir packages/kit test:server-side-route-resolution:build",
"test:svelte-async:dev": "pnpm run --dir packages/kit test:svelte-async:dev",
"test:svelte-async:build": "pnpm run --dir packages/kit test:svelte-async:build",
"test:vite-ecosystem-ci": "pnpm --dir packages/kit test",
"test:others": "pnpm -F @sveltejs/kit prepublishOnly && pnpm -r --filter='./packages/*' --filter=!./packages/kit/ --workspace-concurrency=1 test",
"test:others:unit": "pnpm -F @sveltejs/kit prepublishOnly && pnpm -r --filter=\"./packages/*\" --filter=\"!./packages/kit\" --workspace-concurrency=1 test:unit",
Expand Down
6 changes: 0 additions & 6 deletions packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,10 @@
"test:integration": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test",
"test:dev": "pnpm -r --workspace-concurrency 2 --filter=\"./test/**\" test:dev",
"test:build": "pnpm -r --workspace-concurrency 2 --filter=\"./test/**\" test:build",
"test:dev:basics": "pnpm --filter=test-basics test:dev",
"test:dev:rest": "pnpm -r --workspace-concurrency 2 --filter=\"./test/**\" --filter=\"!test-basics\" test:dev",
"test:build:basics": "pnpm --filter=test-basics test:build",
"test:build:rest": "pnpm -r --workspace-concurrency 2 --filter=\"./test/**\" --filter=\"!test-basics\" test:build",
"test:cross-platform:dev": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:cross-platform:dev",
"test:cross-platform:build": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:cross-platform:build",
"test:server-side-route-resolution:dev": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:server-side-route-resolution:dev",
"test:server-side-route-resolution:build": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:server-side-route-resolution:build",
"test:svelte-async:dev": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:svelte-async:dev",
"test:svelte-async:build": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:svelte-async:build",
"test:unit": "vitest run -c vitest.kit.config.js",
"tsc-native": "node node_modules/@typescript/native/bin/tsc",
"prepublishOnly": "pnpm generate:types",
Expand Down
14 changes: 2 additions & 12 deletions packages/kit/test/apps/async/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
import process from 'node:process';
import { config, port } from '../../utils.js';
import { defineConfig } from '@playwright/test';
import { configure } from '../../utils.js';

export default defineConfig({
...config,
webServer: {
command: process.env.DEV
? `pnpm dev --port ${port} --strictPort`
: `pnpm build && pnpm preview --port ${port} --strictPort`,
port
}
});
export default configure();
10 changes: 4 additions & 6 deletions packages/kit/test/apps/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
"preview": "vite preview",
"check": "svelte-kit sync && node node_modules/@typescript/native/bin/tsc && svelte-check --tsgo --incremental",
"test": "pnpm test:dev && pnpm test:build",
"test:dev": "node test/setup.js && DEV=true playwright test",
"test:build": "node test/setup.js && PUBLIC_PRERENDERING=false playwright test",
"test:dev": "pnpm pw:dev",
"test:build": "pnpm pw:build",
"pw:dev": "node test/setup.js && DEV=true playwright test",
"pw:build": "node test/setup.js && playwright test",
"test:cross-platform:dev": "pnpm test:client-import && node test/setup.js && DEV=true playwright test test/cross-platform/",
"test:cross-platform:build": "node test/setup.js && playwright test test/cross-platform/",
"test:server-side-route-resolution:dev": "node test/setup.js && DEV=true ROUTER_RESOLUTION=server playwright test",
"test:server-side-route-resolution:build": "node test/setup.js && PUBLIC_PRERENDERING=false ROUTER_RESOLUTION=server playwright test",
"test:svelte-async:dev": "node test/setup.js && DEV=true SVELTE_ASYNC=true playwright test",
"test:svelte-async:build": "node test/setup.js && PUBLIC_PRERENDERING=false SVELTE_ASYNC=true playwright test",
"test:client-import": "svelte-kit sync && vitest run"
},
"devDependencies": {
Expand Down
19 changes: 4 additions & 15 deletions packages/kit/test/apps/basics/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import process from 'node:process';
import { config, port } from '../../utils.js';
import { defineConfig } from '@playwright/test';
import { configure } from '../../utils.js';

export default defineConfig({
...config,
webServer: {
command: process.env.DEV
? `pnpm dev --port ${port} --strictPort`
: `pnpm build && pnpm preview --port ${port} --strictPort`,
port,
env: {
PUBLIC_PRERENDERING: 'false',
ROUTER_RESOLUTION: process.env.ROUTER_RESOLUTION ?? 'client'
}
}
export default configure({
async: { SVELTE_ASYNC: 'true' },
resolution: { ROUTER_RESOLUTION: 'server' }
});
4 changes: 2 additions & 2 deletions packages/kit/test/apps/basics/test/client.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import process from 'node:process';
import { expect } from '@playwright/test';
import { test } from '../../../utils.js';
import { test, variant } from '../../../utils.js';

/** @typedef {import('@playwright/test').Response} Response */

Expand Down Expand Up @@ -919,7 +919,7 @@
});

test.describe('data-sveltekit attributes', () => {
test('data-sveltekit-preload-code', async ({ page }) => {

Check warning on line 922 in packages/kit/test/apps/basics/test/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (basics options, pw:dev, resolution, js, 1/2)

flaky test: data-sveltekit-preload-code

retries: 2
/** @type {string[]} */
const responses = [];

Expand Down Expand Up @@ -1068,7 +1068,7 @@
expect(requests.length).toBe(3);
});

test('data-sveltekit-preload-data network failure does not trigger navigation', async ({

Check warning on line 1071 in packages/kit/test/apps/basics/test/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (basics, pw:build, async, js, 1/2)

flaky test: data-sveltekit-preload-data network failure does not trigger navigation

retries: 2
page,
context,
browserName
Expand Down Expand Up @@ -2587,7 +2587,7 @@
});

test('Apply reroute to preload data', async ({ page }) => {
if (process.env.SVELTE_ASYNC === 'true') return; // TODO investigate
if (variant === 'async') return; // TODO investigate
await page.goto('/reroute/preload-data');
await page.click('button');
await page.waitForSelector('pre');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import process from 'node:process';
import { expect } from '@playwright/test';
import { test } from '../../../../utils.js';
import { test, variant } from '../../../../utils.js';

/** @typedef {{ fromScroll: { x: number, y: number }, toScroll: { x: number, y: number }, type: string }} ScrollState */

Expand Down Expand Up @@ -99,7 +99,7 @@
.toBe(0);
});

test('reset: false preserves focus', async ({ page }) => {

Check warning on line 102 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (test:cross-platform:build, windows-latest, 2)

flaky test: reset: false preserves focus

retries: 2
await page.goto('/keepfocus');

await Promise.all([
Expand Down Expand Up @@ -233,7 +233,7 @@
expect(await page.textContent('h1')).toBe('before_navigate_ran: false');
});

test('beforeNavigate cancel() on an unloading navigation does not prevent subsequent beforeNavigate callbacks', async ({

Check warning on line 236 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (basics, pw:build, js, 1/2)

flaky test: beforeNavigate cancel() on an unloading navigation does not prevent subsequent beforeNavigate callbacks

retries: 2
page,
app
}) => {
Expand Down Expand Up @@ -641,7 +641,7 @@
await expect(page.locator('input')).toBeFocused();
});

test('scroll positions are recovered on reloading the page', async ({

Check warning on line 644 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (test:cross-platform:build, windows-latest, 2)

flaky test: scroll positions are recovered on reloading the page

retries: 2
page,
app,
browserName,
Expand Down Expand Up @@ -696,7 +696,7 @@
}
});

test('Scroll position is correct after going back from a shallow route', async ({

Check warning on line 699 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (basics options, pw:dev, resolution, js, 1/2)

flaky test: Scroll position is correct after going back from a shallow route

retries: 2
page,
scroll_to
}) => {
Expand Down Expand Up @@ -903,7 +903,7 @@
// with server-side route resolution the loaders were cached during `match`,
// so no additional `__route.js` request may occur. In client-resolution mode
// this is trivially true (no `__route.js` requests exist at all) — the test is
// meaningful under the `test:server-side-route-resolution:*` suites, so don't
// meaningful under the `resolution` variant, so don't
// remove it from the matrix
expect(requests.filter((r) => r.includes('__route.js'))).toEqual([]);
});
Expand Down Expand Up @@ -956,7 +956,7 @@
// `/set-cookie` is a `+server.js` with no `+page`, so there is no code to preload
await app.preloadCode('/set-cookie');

if (process.env.ROUTER_RESOLUTION) {
if (variant === 'resolution') {
// under server resolution the endpoint tells us the route exists but has no page
expect(warnings.join('\n')).toMatch('has no `+page`');
} else {
Expand All @@ -966,7 +966,7 @@
}
});

if (!process.env.ROUTER_RESOLUTION) {
if (variant !== 'resolution') {
test('hints at `match` when preloadCode is called with a pathname', async ({ page, app }) => {
await page.goto('/routing/a');

Expand Down Expand Up @@ -1032,7 +1032,7 @@
await expect(page.locator('h1')).not.toHaveText('Oopsie');
});

test('same route hash links work more than once', async ({ page, clicknav, baseURL }) => {

Check warning on line 1035 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (basics, pw:build, js, 1/2)

flaky test: same route hash links work more than once

retries: 2
await page.goto('/routing/hashes/a');

await clicknav('[href="#preload"]', { waitForURL: `${baseURL}/routing/hashes/a#preload` });
Expand Down Expand Up @@ -1126,7 +1126,7 @@
await expect(page.locator('#page-url-hash')).toHaveText('#target');
});

test('clicking on a hash link focuses the associated element', async ({ page }) => {

Check warning on line 1129 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (test:cross-platform:build, windows-latest, 2)

flaky test: clicking on a hash link focuses the associated element

retries: 2
await page.goto('/routing/hashes/focus');
await page.locator('a[href="#example"]').click();
await expect(page.getByRole('textbox')).toBeFocused();
Expand Down Expand Up @@ -1239,14 +1239,14 @@
expect(await page.textContent('h1')).toBe('hello');
});

test('recognizes clicks outside the app target', async ({ page }) => {

Check warning on line 1242 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (test:cross-platform:build, windows-latest, 2)

flaky test: recognizes clicks outside the app target

retries: 2
await page.goto('/routing/link-outside-app-target/source');

await page.locator('[href="/routing/link-outside-app-target/target"]').click();
await expect(page.locator('h1')).toHaveText('target: 1');
});

test('responds to <form method="GET"> submission without reload', async ({ page }) => {

Check warning on line 1249 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / e2e (basics options, pw:build, resolution, js, 1/2)

flaky test: responds to <form method="GET"> submission without reload

retries: 2
// wait until load to ensure that all in-flight requests are completed before
// we start watching requests
await page.goto('/routing/form-get', { waitUntil: 'load' });
Expand Down
4 changes: 3 additions & 1 deletion packages/kit/test/apps/dev-only/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { config as default } from '../../utils.js';
import { configure } from '../../utils.js';

export default configure();
4 changes: 3 additions & 1 deletion packages/kit/test/apps/embed/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { config as default } from '../../utils.js';
import { configure } from '../../utils.js';

export default configure();
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { config as default } from '../../utils.js';
import { configure } from '../../utils.js';

export default configure();
4 changes: 3 additions & 1 deletion packages/kit/test/apps/no-csr/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { config as default } from '../../utils.js';
import { configure } from '../../utils.js';

export default configure();
4 changes: 3 additions & 1 deletion packages/kit/test/apps/no-ssr/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { config as default } from '../../utils.js';
import { configure } from '../../utils.js';

export default configure();
6 changes: 4 additions & 2 deletions packages/kit/test/apps/options-2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
"preview": "RUNTIME_ONLY=secret vite preview",
"check": "svelte-kit sync && node node_modules/@typescript/native/bin/tsc && svelte-check --tsgo --incremental",
"test": "pnpm test:dev && pnpm test:build",
"test:dev": "DEV=true playwright test && REGISTER_SERVICE_WORKER=true DEV=true playwright test",
"test:build": "NODE_ENV=custom DYNAMIC_PUBLIC_ENV=true playwright test && REGISTER_SERVICE_WORKER=true playwright test"
"test:dev": "pnpm pw:dev && KIT_E2E_VARIANT=service-worker pnpm pw:dev",
"test:build": "KIT_E2E_VARIANT=dynamic-env pnpm pw:build && KIT_E2E_VARIANT=service-worker pnpm pw:build",
"pw:dev": "DEV=true playwright test",
"pw:build": "playwright test"
},
"devDependencies": {
"@sveltejs/adapter-node": "workspace:^",
Expand Down
7 changes: 6 additions & 1 deletion packages/kit/test/apps/options-2/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
export { config as default } from '../../utils.js';
import { configure } from '../../utils.js';

export default configure({
'service-worker': { REGISTER_SERVICE_WORKER: 'true' },
'dynamic-env': { NODE_ENV: 'custom', DYNAMIC_PUBLIC_ENV: 'true' }
});
14 changes: 7 additions & 7 deletions packages/kit/test/apps/options-2/test/env.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { execFile } from 'node:child_process';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import { expect } from '@playwright/test';
import { test } from '../../../utils.js';
import { test, variant } from '../../../utils.js';

const output = fileURLToPath(new URL('../.svelte-kit/output', import.meta.url));

Expand All @@ -14,7 +14,7 @@ test.describe.configure({ mode: 'parallel' });

test.describe('env', () => {
test('resolves upwards', async ({ page }) => {
test.skip(!process.env.DYNAMIC_PUBLIC_ENV);
test.skip(variant !== 'dynamic-env');

await page.goto('/basepath/env');
expect(await page.textContent('[data-testid="public"]')).toBe('public: hello');
Expand All @@ -30,7 +30,7 @@ test.describe('env', () => {
});

test('applies explicit env vars to %sveltekit.env%', async ({ page }) => {
test.skip(!process.env.DYNAMIC_PUBLIC_ENV);
test.skip(variant !== 'dynamic-env');

await page.goto('/basepath');
await expect(page.locator('body')).toHaveAttribute('data-message', 'hello');
Expand All @@ -39,7 +39,7 @@ test.describe('env', () => {
test('does not import env.js or embed env in prerendered pages when there are no public dynamic environment variables', ({
javaScriptEnabled
}) => {
test.skip(javaScriptEnabled || !!process.env.DEV || !!process.env.DYNAMIC_PUBLIC_ENV);
test.skip(javaScriptEnabled || !!process.env.DEV || variant === 'dynamic-env');

const root_page = read('prerendered/pages/env/prerendered.html');
expect(root_page).not.toContain('_app/env.js');
Expand All @@ -50,7 +50,7 @@ test.describe('env', () => {

test.describe('$app/env', () => {
test('correct values are exported from $app/env/*', async ({ page }) => {
test.skip(!process.env.DYNAMIC_PUBLIC_ENV);
test.skip(variant !== 'dynamic-env');

await page.goto('/basepath/env/import-all');

Expand All @@ -69,7 +69,7 @@ test.describe('$app/env', () => {
test('loads dynamic public environment variables in the service worker', ({
javaScriptEnabled
}) => {
test.skip(javaScriptEnabled || !!process.env.DEV || !process.env.DYNAMIC_PUBLIC_ENV);
test.skip(javaScriptEnabled || !!process.env.DEV || variant !== 'dynamic-env');

const content = read('/prerendered/dependencies/_app/env.js');
expect(content).toContain('hello');
Expand All @@ -81,7 +81,7 @@ test.describe('$app/env', () => {
test('does not load env.js in the service worker when there are no public dynamic environment variables', ({
javaScriptEnabled
}) => {
test.skip(javaScriptEnabled || !!process.env.DEV || !!process.env.DYNAMIC_PUBLIC_ENV);
test.skip(javaScriptEnabled || !!process.env.DEV || variant === 'dynamic-env');

const serviceWorker = read('/client/service-worker.js');
expect(serviceWorker).not.toContain('import { env } from "/basepath/_app/env.js"');
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/test/apps/options-2/test/service-worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import path from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import { expect } from '@playwright/test';
import { test } from '../../../utils.js';
import { test, variant } from '../../../utils.js';

test.skip(({ javaScriptEnabled }) => !javaScriptEnabled || !process.env.REGISTER_SERVICE_WORKER);
test.skip(({ javaScriptEnabled }) => !javaScriptEnabled || variant !== 'service-worker');

test('import proxy /basepath/service-worker.js', async ({ request }) => {
test.skip(!process.env.DEV);
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/test/apps/options-2/test/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import process from 'node:process';
import { expect } from '@playwright/test';
import { test } from '../../../utils.js';
import { test, variant } from '../../../utils.js';

test.skip(() => !!process.env.REGISTER_SERVICE_WORKER);
test.skip(() => variant === 'service-worker');

test.describe.configure({ mode: 'parallel' });

Expand Down
4 changes: 3 additions & 1 deletion packages/kit/test/apps/options-3/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { config as default } from '../../utils.js';
import { configure } from '../../utils.js';

export default configure();
Loading
Loading