Skip to content

Commit 0fc9c40

Browse files
committed
add e2e test app with kit-tracing enabled
1 parent ea0740c commit 0fc9c40

Some content is hidden

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

54 files changed

+1524
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
vite.config.js.timestamp-*
10+
vite.config.ts.timestamp-*
11+
12+
#temporarily excluding my remote function routes. To be removed with the next PR:
13+
./src/routes/remote-functions/data.remote.ts
14+
./src/routes/remote-functions/+page.svelte
15+
./tests/tracing.remote-functions.ts
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@sentry:registry=http://127.0.0.1:4873
2+
@sentry-internal:registry=http://127.0.0.1:4873
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# create-svelte
2+
3+
Everything you need to build a Svelte project, powered by
4+
[`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
5+
6+
## Creating a project
7+
8+
If you're seeing this, you've probably already done this step. Congrats!
9+
10+
```bash
11+
# create a new project in the current directory
12+
npm create svelte@latest
13+
14+
# create a new project in my-app
15+
npm create svelte@latest my-app
16+
```
17+
18+
## Developing
19+
20+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a
21+
development server:
22+
23+
```bash
24+
npm run dev
25+
26+
# or start the server and open the app in a new browser tab
27+
npm run dev -- --open
28+
```
29+
30+
## Building
31+
32+
To create a production version of your app:
33+
34+
```bash
35+
npm run build
36+
```
37+
38+
You can preview the production build with `npm run preview`.
39+
40+
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target
41+
> environment.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "sveltekit-2-kit-tracing",
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",
14+
"test:build": "pnpm install && pnpm build",
15+
"test:assert": "pnpm test:prod"
16+
},
17+
"dependencies": {
18+
"@sentry/sveltekit": "latest || *",
19+
"@spotlightjs/spotlight": "2.0.0-alpha.1"
20+
},
21+
"devDependencies": {
22+
"@playwright/test": "~1.53.2",
23+
"@sentry-internal/test-utils": "link:../../../test-utils",
24+
"@sveltejs/adapter-node": "^5.3.1",
25+
"@sveltejs/kit": "^2.31.0",
26+
"@sveltejs/vite-plugin-svelte": "^6.1.3",
27+
"svelte": "^5.38.3",
28+
"svelte-check": "^4.3.1",
29+
"tslib": "^2.4.1",
30+
"typescript": "^5.0.0",
31+
"vite": "^7.1.3"
32+
},
33+
"type": "module",
34+
"volta": {
35+
"extends": "../../package.json"
36+
}
37+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { getPlaywrightConfig } from '@sentry-internal/test-utils';
2+
3+
const config = getPlaywrightConfig({
4+
startCommand: 'ORIGIN=http://localhost:3030 node ./build/index.js',
5+
port: 3030,
6+
});
7+
8+
export default config;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// See https://kit.svelte.dev/docs/types#app
2+
// for information about these interfaces
3+
declare global {
4+
namespace App {
5+
// interface Error {}
6+
// interface Locals {}
7+
// interface PageData {}
8+
// interface PageState {}
9+
// interface Platform {}
10+
}
11+
}
12+
13+
export {};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
%sveltekit.head%
8+
</head>
9+
<body data-sveltekit-preload-data="hover">
10+
<div style="display: contents">%sveltekit.body%</div>
11+
</body>
12+
</html>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { env } from '$env/dynamic/public';
2+
import * as Sentry from '@sentry/sveltekit';
3+
import * as Spotlight from '@spotlightjs/spotlight';
4+
5+
Sentry.init({
6+
environment: 'qa', // dynamic sampling bias to keep transactions
7+
dsn: env.PUBLIC_E2E_TEST_DSN,
8+
debug: !!env.PUBLIC_DEBUG,
9+
tunnel: `http://localhost:3031/`, // proxy server
10+
tracesSampleRate: 1.0,
11+
});
12+
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+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as Sentry from '@sentry/sveltekit';
2+
import { setupSidecar } from '@spotlightjs/spotlight/sidecar';
3+
import { sequence } from '@sveltejs/kit/hooks';
4+
5+
// not logging anything to console to avoid noise in the test output
6+
export const handleError = Sentry.handleErrorWithSentry(() => {});
7+
8+
export const handle = sequence(Sentry.sentryHandle());
9+
10+
if (import.meta.env.DEV) {
11+
setupSidecar();
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as Sentry from '@sentry/sveltekit';
2+
import { E2E_TEST_DSN } from '$env/static/private';
3+
4+
Sentry.init({
5+
environment: 'qa', // dynamic sampling bias to keep transactions
6+
dsn: E2E_TEST_DSN,
7+
debug: !!process.env.DEBUG,
8+
tunnel: `http://localhost:3031/`, // proxy server
9+
tracesSampleRate: 1.0,
10+
spotlight: import.meta.env.DEV,
11+
});

0 commit comments

Comments
 (0)