Skip to content

Commit 5ecc0df

Browse files
SG60Lms24
authored andcommitted
test(sveltekit-cloudflare): simpler e2e test
Just test whether it builds successfully
1 parent be238d4 commit 5ecc0df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+109
-1148
lines changed
Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
.DS_Store
1+
test-results
22
node_modules
3-
/build
3+
4+
# Output
5+
.output
6+
.vercel
7+
.netlify
8+
.wrangler
49
/.svelte-kit
5-
/.wrangler
6-
/package
10+
/build
11+
12+
# OS
13+
.DS_Store
14+
Thumbs.db
15+
16+
# Env
717
.env
818
.env.*
919
!.env.example
20+
!.env.test
21+
22+
# Vite
1023
vite.config.js.timestamp-*
1124
vite.config.ts.timestamp-*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@sentry:registry=http://127.0.0.1:4873
22
@sentry-internal:registry=http://127.0.0.1:4873
3+
engine-strict=true

dev-packages/e2e-tests/test-applications/sveltekit-cloudflare-pages/README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
# create-svelte
1+
# sv
22

3-
Everything you need to build a Svelte project, powered by
4-
[`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
3+
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
54

65
## Creating a project
76

87
If you're seeing this, you've probably already done this step. Congrats!
98

109
```bash
1110
# create a new project in the current directory
12-
npm create svelte@latest
11+
npx sv create
1312

1413
# create a new project in my-app
15-
npm create svelte@latest my-app
14+
npx sv create my-app
1615
```
1716

1817
## Developing
1918

20-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a
21-
development server:
19+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
2220

2321
```bash
2422
npm run dev
@@ -37,5 +35,4 @@ npm run build
3735

3836
You can preview the production build with `npm run preview`.
3937

40-
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target
41-
> environment.
38+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { expect, test } from '@playwright/test';
2+
3+
test('home page has expected h1', async ({ page }) => {
4+
await page.goto('/');
5+
await expect(page.locator('h1')).toBeVisible();
6+
});
Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
11
{
2-
"name": "sveltekit-cloudflare-pages",
3-
"version": "0.0.1",
4-
"private": true,
5-
"scripts": {
6-
"dev": "vite dev",
7-
"build": "vite build",
8-
"preview": "vite preview",
9-
"proxy": "node start-event-proxy.mjs",
10-
"clean": "npx rimraf node_modules pnpm-lock.yaml",
11-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
13-
"test:prod": "TEST_ENV=production playwright test",
2+
"name": "sveltekit-cloudflare-pages",
3+
"private": true,
4+
"version": "0.0.1",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite dev",
8+
"build": "vite build",
9+
"preview": "wrangler pages dev ./.svelte-kit/cloudflare --port 4173",
10+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
11+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
12+
"test:e2e": "playwright test",
13+
"test": "npm run test:e2e",
1414
"test:build": "pnpm install && pnpm build",
15-
"test:assert": "pnpm test:prod"
16-
},
15+
"test:assert": "npm run test:e2e"
16+
},
1717
"dependencies": {
18-
"@sentry/sveltekit": "latest || *",
19-
"@spotlightjs/spotlight": "2.0.0-alpha.1"
20-
},
21-
"devDependencies": {
22-
"@playwright/test": "^1.44.1",
23-
"@sentry-internal/test-utils": "link:../../../test-utils",
24-
"@sentry/core": "latest || *",
25-
"@sveltejs/adapter-cloudflare": "^4.0.0",
26-
"@sveltejs/kit": "^2.0.0",
27-
"@sveltejs/vite-plugin-svelte": "^4.0.0",
28-
"svelte": "^5.0.0",
29-
"svelte-check": "^3.6.0",
30-
"tslib": "^2.4.1",
31-
"typescript": "^5.0.0",
32-
"vite": "^5.4.10",
33-
"wrangler": "^3.95.0"
18+
"@sentry/sveltekit": "latest || *"
3419
},
35-
"type": "module"
20+
"devDependencies": {
21+
"@playwright/test": "^1.45.3",
22+
"@sveltejs/adapter-cloudflare": "^4.8.0",
23+
"@sveltejs/kit": "^2.9.0",
24+
"@sveltejs/vite-plugin-svelte": "^5.0.0",
25+
"svelte": "^5.0.0",
26+
"svelte-check": "^4.0.0",
27+
"typescript": "^5.0.0",
28+
"vite": "^6.0.0",
29+
"wrangler": "^3"
30+
}
3631
}

dev-packages/e2e-tests/test-applications/sveltekit-cloudflare-pages/playwright.config.mjs

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from '@playwright/test';
2+
3+
export default defineConfig({
4+
webServer: {
5+
command: 'npm run build && npm run preview',
6+
port: 4173
7+
},
8+
9+
testDir: 'e2e'
10+
});
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
// See https://kit.svelte.dev/docs/types#app
1+
// See https://svelte.dev/docs/kit/types#app.d.ts
22
// for information about these interfaces
33
declare global {
4-
namespace App {
5-
// interface Error {}
6-
// interface Locals {}
7-
// interface PageData {}
8-
// interface PageState {}
9-
// interface Platform {}
10-
}
4+
namespace App {
5+
// interface Error {}
6+
// interface Locals {}
7+
// interface PageData {}
8+
// interface PageState {}
9+
// interface Platform {}
10+
}
1111
}
1212

1313
export {};
Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
import { env } from '$env/dynamic/public';
22
import * as Sentry from '@sentry/sveltekit';
3-
import * as Spotlight from '@spotlightjs/spotlight';
43

54
Sentry.init({
6-
environment: 'qa', // dynamic sampling bias to keep transactions
75
dsn: env.PUBLIC_E2E_TEST_DSN,
8-
debug: !!env.PUBLIC_DEBUG,
9-
tunnel: `http://localhost:3031/`, // proxy server
10-
tracesSampleRate: 1.0,
116
});
127

13-
const myErrorHandler = ({ error, event }: any) => {
14-
console.error('An error occurred on the client side:', error, event);
15-
};
16-
17-
export const handleError = Sentry.handleErrorWithSentry(myErrorHandler);
18-
19-
if (import.meta.env.DEV) {
20-
Spotlight.init({
21-
injectImmediately: true,
22-
});
23-
}
8+
export const handleError = Sentry.handleErrorWithSentry();
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
import { E2E_TEST_DSN } from '$env/static/private';
2-
import * as Sentry from '@sentry/sveltekit';
2+
import { handleErrorWithSentry, initCloudflareSentryHandle, sentryHandle } from '@sentry/sveltekit';
33
import { sequence } from '@sveltejs/kit/hooks';
44

5-
// not logging anything to console to avoid noise in the test output
6-
export const handleError = Sentry.handleErrorWithSentry(() => { });
5+
export const handleError = handleErrorWithSentry();
76

87
export const handle = sequence(
9-
Sentry.initCloudflareSentryHandle({
10-
environment: 'qa', // dynamic sampling bias to keep transactions
8+
initCloudflareSentryHandle({
119
dsn: E2E_TEST_DSN,
12-
debug: !!process.env.DEBUG,
13-
tunnel: `http://localhost:3031/`, // proxy server
14-
tracesSampleRate: 1.0,
1510
}),
16-
Sentry.sentryHandle(),
11+
sentryHandle(),
1712
);

0 commit comments

Comments
 (0)