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
2 changes: 1 addition & 1 deletion dev-packages/bun-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@sentry-internal/node-integration-tests": "11.0.0",
"@sentry-internal/test-utils": "11.0.0",
"bun-types": "^1.2.9",
"vitest": "^3.2.7"
"vitest": "^4.1.11"
},
"volta": {
"extends": "../../package.json"
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/bun-integration-tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"include": ["suites/**/*.ts", "node-suites/**/*.ts", "*.ts"],

"compilerOptions": {
"lib": ["ES2020"],
"lib": ["DOM", "ES2020"],
"esModuleInterop": true,
"types": ["bun-types"]
}
Expand Down
8 changes: 3 additions & 5 deletions dev-packages/bun-integration-tests/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ export default defineConfig({
env: { RUNTIME: 'bun' },
// Above the 30 second port timeout of the runner on Bun, so a slow start can still pass.
testTimeout: 45_000,
poolOptions: {
threads: {
singleThread: true,
},
},
maxWorkers: 1,
// Vitest requires projects with a different `maxWorkers` to run in their own group.
sequence: { groupOrder: 1 },
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/bundler-plugin-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"devDependencies": {
"premove": "^4.0.0",
"typescript": "~6.0.3",
"vitest": "^3.2.7"
"vitest": "^4.1.11"
},
"volta": {
"extends": "../../package.json"
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/bundler-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"@rollup/plugin-node-resolve": "^16.0.3",
"@sentry/browser": "11.0.0",
"rollup": "^4.60.3",
"vite": "^6.4.3",
"vitest": "^3.2.7",
"vite": "^8.3.1",
"vitest": "^4.1.11",
"webpack": "^5.0.0"
},
"volta": {
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/cloudflare-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"@sentry/conventions": "0.24.0",
"eslint-plugin-regexp": "^3.1.0",
"prisma": "6.15.0",
"vite": "7.3.5",
"vitest": "^3.2.7",
"vite": "^8.3.1",
"vitest": "^4.1.11",
"wrangler": "4.86.0"
},
"volta": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference lib="dom" />
import { streamText } from 'ai';

// The browser bundle also pulls in an orchestrion-instrumented module (`ai`).
Expand Down
6 changes: 1 addition & 5 deletions dev-packages/cloudflare-integration-tests/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ export default defineConfig({
// overhead is significantly less.
pool: 'threads',
// Run tests sequentially to avoid port conflicts with wrangler dev processes
poolOptions: {
threads: {
singleThread: true,
},
},
maxWorkers: 1,
sequence: {
shuffle: true,
},
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/deno-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"devDependencies": {
"@sentry-internal/node-integration-tests": "11.0.0",
"vitest": "^3.2.7"
"vitest": "^4.1.11"
},
"volta": {
"extends": "../../package.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"rollup": "^4.35.0",
"vitest": "^3.2.7",
"vitest": "^4.1.11",
"@sentry/rollup-plugin": "^5.3.0"
},
"volta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,56 +28,52 @@ function splitFrameContext(frame: SerializedFrame): Record<string, unknown> {
};
}

test(
'Find symbolicated event on sentry',
async ({ expect }) => {
const eventId = childProcess.execSync(`node ${path.join(__dirname, '..', 'dist', 'app.js')}`, {
encoding: 'utf-8',
});

console.log(`Polling for error eventId: ${eventId}`);
test('Find symbolicated event on sentry', { timeout: EVENT_POLLING_TIMEOUT }, async ({ expect }) => {
const eventId = childProcess.execSync(`node ${path.join(__dirname, '..', 'dist', 'app.js')}`, {
encoding: 'utf-8',
});

let timedOut = false;
setTimeout(() => {
timedOut = true;
}, EVENT_POLLING_TIMEOUT);
console.log(`Polling for error eventId: ${eventId}`);

while (!timedOut) {
await new Promise(resolve => setTimeout(resolve, 2000)); // poll every two seconds
const response = await fetch(`https://sentry.io/api/0/organizations/${sentryTestOrgSlug}/eventids/${eventId}/`, {
headers: { Authorization: `Bearer ${authToken}` },
});
let timedOut = false;
setTimeout(() => {
timedOut = true;
}, EVENT_POLLING_TIMEOUT);

// This is org scoped, so the auth token needs `org:read` on top of the project scopes.
// That never resolves by waiting, so fail loudly rather than timing out.
if (response.status === 401 || response.status === 403) {
throw new Error(
`Event lookup was rejected with ${response.status}: ${await response.text()}. ` +
'E2E_TEST_AUTH_TOKEN needs the `org:read` scope.',
);
}
while (!timedOut) {
await new Promise(resolve => setTimeout(resolve, 2000)); // poll every two seconds
const response = await fetch(`https://sentry.io/api/0/organizations/${sentryTestOrgSlug}/eventids/${eventId}/`, {
headers: { Authorization: `Bearer ${authToken}` },
});

// A 404 means the event has not landed yet and a 429 is the shared test org being rate limited.
// Both clear up by polling again.
if (!response.ok) {
expect([404, 429]).toContain(response.status);
continue;
}
// This is org scoped, so the auth token needs `org:read` on top of the project scopes.
// That never resolves by waiting, so fail loudly rather than timing out.
if (response.status === 401 || response.status === 403) {
throw new Error(
`Event lookup was rejected with ${response.status}: ${await response.text()}. ` +
'E2E_TEST_AUTH_TOKEN needs the `org:read` scope.',
);
}

const { event } = await response.json();
const exception = event.entries.find((entry: { type: string }) => entry.type === 'exception');
const frames: SerializedFrame[] = exception.data.values[0].stacktrace.frames;
const topFrame = frames[frames.length - 1];
// A 404 means the event has not landed yet and a 429 is the shared test org being rate limited.
// Both clear up by polling again.
if (!response.ok) {
expect([404, 429]).toContain(response.status);
continue;
}

if (topFrame === undefined) {
throw new Error('Symbolicated event has no stack frames.');
}
const { event } = await response.json();
const exception = event.entries.find((entry: { type: string }) => entry.type === 'exception');
const frames: SerializedFrame[] = exception.data.values[0].stacktrace.frames;
const topFrame = frames[frames.length - 1];

expect(splitFrameContext(topFrame)).toMatchSnapshot();
return;
if (topFrame === undefined) {
throw new Error('Symbolicated event has no stack frames.');
}

throw new Error('Test timed out');
},
{ timeout: EVENT_POLLING_TIMEOUT },
);
expect(splitFrameContext(topFrame)).toMatchSnapshot();
return;
}

throw new Error('Test timed out');
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"@size-limit/webpack": "~12.1.0",
"@types/jsdom": "^21.1.6",
"@types/node": "^18.19.1",
"@vitest/coverage-v8": "^3.2.7",
"@vitest/coverage-v8": "^4.1.11",
"deepmerge": "^4.2.2",
"es-check": "^7.2.1",
"esbuild": "^0.28.1",
Expand All @@ -143,7 +143,7 @@
"size-limit": "~12.1.0",
"tsx": "^4.23.0",
"typescript": "~7.0.2",
"vitest": "^3.2.7",
"vitest": "^4.1.11",
"yalc": "^1.0.0-pre.53",
"yarn-deduplicate": "6.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
"devDependencies": {
"astro": "^4.16.19",
"vite": "^6.4.3"
"vite": "^8.3.1"
},
"scripts": {
"build": "run-p build:transpile build:types",
Expand Down
55 changes: 38 additions & 17 deletions packages/browser/test/profiling/UIProfiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ describe('Browser Profiling v2 trace lifecycle', () => {
addEventListener() {}
}

const mockConstructor = vi.fn().mockImplementation((opts: { sampleInterval: number; maxBufferSize: number }) => {
const mockConstructor = vi.fn().mockImplementation(function (opts: {
sampleInterval: number;
maxBufferSize: number;
}) {
return new MockProfilerImpl(opts);
});

Expand Down Expand Up @@ -348,9 +351,12 @@ describe('Browser Profiling v2 trace lifecycle', () => {
addEventListener() {}
}

(window as any).Profiler = vi
.fn()
.mockImplementation((opts: { sampleInterval: number; maxBufferSize: number }) => new MockProfilerImpl(opts));
(window as any).Profiler = vi.fn().mockImplementation(function (opts: {
sampleInterval: number;
maxBufferSize: number;
}) {
return new MockProfilerImpl(opts);
});

const send = vi.fn().mockResolvedValue(undefined);

Expand Down Expand Up @@ -408,9 +414,12 @@ describe('Browser Profiling v2 trace lifecycle', () => {
addEventListener() {}
}

(window as any).Profiler = vi
.fn()
.mockImplementation((opts: { sampleInterval: number; maxBufferSize: number }) => new MockProfilerImpl(opts));
(window as any).Profiler = vi.fn().mockImplementation(function (opts: {
sampleInterval: number;
maxBufferSize: number;
}) {
return new MockProfilerImpl(opts);
});

const send = vi.fn().mockResolvedValue(undefined);

Expand Down Expand Up @@ -462,9 +471,12 @@ describe('Browser Profiling v2 trace lifecycle', () => {
addEventListener() {}
}

(window as any).Profiler = vi
.fn()
.mockImplementation((opts: { sampleInterval: number; maxBufferSize: number }) => new MockProfilerImpl(opts));
(window as any).Profiler = vi.fn().mockImplementation(function (opts: {
sampleInterval: number;
maxBufferSize: number;
}) {
return new MockProfilerImpl(opts);
});

const send = vi.fn().mockResolvedValue(undefined);

Expand Down Expand Up @@ -521,9 +533,12 @@ describe('Browser Profiling v2 trace lifecycle', () => {
addEventListener() {}
}

(window as any).Profiler = vi
.fn()
.mockImplementation((opts: { sampleInterval: number; maxBufferSize: number }) => new MockProfilerImpl(opts));
(window as any).Profiler = vi.fn().mockImplementation(function (opts: {
sampleInterval: number;
maxBufferSize: number;
}) {
return new MockProfilerImpl(opts);
});

// Session 1
const send1 = vi.fn().mockResolvedValue(undefined);
Expand Down Expand Up @@ -747,7 +762,10 @@ describe('Browser Profiling v2 manual lifecycle', () => {
addEventListener() {}
}

const mockConstructor = vi.fn().mockImplementation((opts: { sampleInterval: number; maxBufferSize: number }) => {
const mockConstructor = vi.fn().mockImplementation(function (opts: {
sampleInterval: number;
maxBufferSize: number;
}) {
return new MockProfilerImpl(opts);
});

Expand Down Expand Up @@ -869,9 +887,12 @@ describe('Browser Profiling v2 manual lifecycle', () => {
addEventListener() {}
}

(window as any).Profiler = vi
.fn()
.mockImplementation((opts: { sampleInterval: number; maxBufferSize: number }) => new MockProfilerImpl(opts));
(window as any).Profiler = vi.fn().mockImplementation(function (opts: {
sampleInterval: number;
maxBufferSize: number;
}) {
return new MockProfilerImpl(opts);
});

const send = vi.fn().mockResolvedValue(undefined);

Expand Down
10 changes: 6 additions & 4 deletions packages/browser/test/profiling/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ describe('BrowserProfilingIntegration', () => {
resources: [],
});

const mockProfiler = vi.fn().mockImplementation(() => ({
stop: stopProfile,
addEventListener: vi.fn(),
}));
const mockProfiler = vi.fn().mockImplementation(function () {
return {
stop: stopProfile,
addEventListener: vi.fn(),
};
});

// @ts-expect-error this is a mock constructor
window.Profiler = mockProfiler;
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"@types/node": "^18.6.3",
"premove": "^4.0.0",
"rolldown": "^1.0.0",
"vitest": "^3.2.7",
"vitest": "^4.1.11",
"webpack": "5.104.1"
},
"volta": {
Expand Down
14 changes: 8 additions & 6 deletions packages/cloudflare/test/durableobject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,12 +806,14 @@ describe('instrumentDurableObjectWithSentry', () => {
const before = flush.mock.calls.length;

const waitUntil = vi.fn();
const testClass = vi.fn(context => ({
fetch: () => {
context.waitUntil(new Promise(res => setTimeout(res)));
return new Response('test');
},
}));
const testClass = vi.fn(function (context) {
return {
fetch: () => {
context.waitUntil(new Promise(res => setTimeout(res)));
return new Response('test');
},
};
});
const instrumented = instrumentDurableObjectWithSentry(vi.fn(), testClass as any);
const context = {
waitUntil,
Expand Down
Loading
Loading