Skip to content
Merged
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
1 change: 1 addition & 0 deletions .cursor/BUGBOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Keep reviews high-signal. Prefer actionable, high-confidence findings over specu
- Flag usage of `expect.objectContaining` and other relaxed assertions, when a test expects something NOT to be included in a payload but there's no respective assertion.
- Flag usage of conditionals in one test and recommend splitting up the test for the different paths.
- Flag usage of loops testing multiple scenarios in one test and recommend using `(it)|(test).each` instead.
- In `dev-packages/node-integration-tests/suites/`, flag tests that check the Node version or the runtime themselves, for example with `process.versions`, `process.env.RUNTIME`, `ctx.skip()`, or a version or runtime condition in `skipIf` / `runIf`. Recommend `test.runIf(supports({ ... }))` or `describe.runIf(supports({ ... }))` from `utils/index.ts` instead.
- Apply the `@sentry/conventions` constants rule from above to test files too. Test assertions on span attributes and ops must use the constants, not string literals.
- Flag tests that are likely to introduce flakes. In our case this usually means we wait for some telemetry requests sent from an SDK. Patterns to look out for:
- Only waiting for a request, after an action is performed. Instead, start waiting, perform action, await request promise.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from 'node:path';
import type { Event } from '@sentry/core';
import { afterAll, describe, expect, test } from 'vitest';
import { NODE_VERSION } from '../../utils/index';
import { supports } from '../../utils/index';
import { cleanupChildProcesses, createRunner } from '../../utils/runner';

function EXCEPTION(thread_id = '0', fn = 'longWork') {
Expand Down Expand Up @@ -240,12 +240,7 @@ describe('Thread Blocked Native', { timeout: 30_000 }, () => {
.completed();
});

test('Capture scope via AsyncLocalStorage', async ctx => {
if (NODE_VERSION < 24) {
ctx.skip();
return;
}

test.runIf(supports({ min: 24 }))('Capture scope via AsyncLocalStorage', async () => {
const instrument = join(__dirname, 'instrument.mjs');
await createRunner(__dirname, 'isolated.mjs')
.withMockSentryServer()
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/node-integration-tests/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { parseSemver } from '@sentry/core';
import { execFileSync } from 'child_process';
import type * as http from 'http';

export const NODE_VERSION = parseSemver(process.versions.node).major || 0;
const NODE_VERSION = parseSemver(process.versions.node).major || 0;

/**
* The runtime that runs the scenarios (`node`, `bun` or `deno`), from the `RUNTIME` env var.
*/
export type Runtime = 'cloudflare' | 'node' | 'bun' | 'deno';
export const RUNTIME = (process.env.RUNTIME || 'node') as Runtime;
const RUNTIME = (process.env.RUNTIME || 'node') as Runtime;

// Vitest runs on Node, so it cannot read `Bun.version` of the `bun` binary that runs the scenarios.
const BUN_VERSION = RUNTIME === 'bun' ? execFileSync('bun', ['--version'], { encoding: 'utf8' }).trim() : undefined;
Expand Down
Loading