-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
ref(deno): add deno-integration-tests dev-package #21827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "$schema": "../../node_modules/oxlint/configuration_schema.json", | ||
| "extends": ["../.oxlintrc.json"], | ||
| "env": { | ||
| "node": true | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "files": ["suites/**/*.ts", "suites/**/*.mjs"], | ||
| "globals": { | ||
| "Deno": "readonly" | ||
| }, | ||
| "rules": { | ||
| "typescript/ban-ts-comment": [ | ||
| "error", | ||
| { | ||
| "ts-ignore": "allow-with-description", | ||
| "ts-expect-error": true | ||
| } | ||
| ], | ||
| "import/first": "off" | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "name": "@sentry-internal/deno-integration-tests", | ||
| "version": "10.62.0", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. m: Just that we don't forget to update. |
||
| "license": "MIT", | ||
| "engines": { | ||
| "node": ">=18" | ||
| }, | ||
| "private": true, | ||
| "scripts": { | ||
| "deno-types": "node ./scripts/download-deno-types.mjs", | ||
| "install:deno": "node ./scripts/install-deno.mjs", | ||
| "lint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --type-aware", | ||
| "lint:fix": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --fix --type-aware", | ||
| "test": "run-s install:deno deno-types test:unit", | ||
| "test:unit": "deno test --allow-net --allow-read --allow-run --allow-env --no-check" | ||
| }, | ||
| "dependencies": { | ||
| "@sentry/core": "10.62.0", | ||
| "@sentry/deno": "10.62.0", | ||
| "mysql": "^2.18.1" | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| }, | ||
| "volta": { | ||
| "extends": "../../package.json" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { existsSync, writeFileSync } from 'fs'; | ||
| import { download } from './download.mjs'; | ||
|
|
||
| if (!existsSync('lib.deno.d.ts')) { | ||
| const code = await download('https://github.com/denoland/deno/releases/download/v2.8.0/lib.deno.d.ts'); | ||
| writeFileSync('lib.deno.d.ts', code); | ||
|
isaacs marked this conversation as resolved.
Dismissed
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /** Download a url to a string */ | ||
| export async function download(url) { | ||
| try { | ||
| return await fetch(url).then(res => res.text()); | ||
| } catch (e) { | ||
| // eslint-disable-next-line no-console | ||
| console.error('Failed to download', url, e); | ||
| process.exit(1); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { execSync } from 'child_process'; | ||
|
|
||
| import { download } from './download.mjs'; | ||
|
|
||
| try { | ||
| execSync('deno --version', { stdio: 'inherit' }); | ||
| } catch { | ||
| // eslint-disable-next-line no-console | ||
| console.error('Deno is not installed. Installing...'); | ||
| if (process.platform === 'win32') { | ||
| // TODO | ||
| // eslint-disable-next-line no-console | ||
| console.error('Please install Deno manually: https://docs.deno.com/runtime/manual/getting_started/installation'); | ||
| process.exit(1); | ||
| } else { | ||
| const script = await download('https://deno.land/install.sh'); | ||
|
|
||
| try { | ||
| execSync(script, { stdio: 'inherit' }); | ||
| } catch (e) { | ||
| // eslint-disable-next-line no-console | ||
| console.error('Failed to install Deno', e); | ||
| process.exit(1); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,11 +2,11 @@ | |
|
|
||
| import { tracingChannel } from 'node:diagnostics_channel'; | ||
| import type { TransactionEvent } from '@sentry/core'; | ||
| import type { DenoClient } from '@sentry/deno'; | ||
| import { getCurrentScope, getGlobalScope, getIsolationScope, init, startSpan } from '@sentry/deno'; | ||
| import { assert } from 'https://deno.land/std@0.212.0/assert/assert.ts'; | ||
| import { assertEquals } from 'https://deno.land/std@0.212.0/assert/assert_equals.ts'; | ||
| import { assertExists } from 'https://deno.land/std@0.212.0/assert/assert_exists.ts'; | ||
| import type { DenoClient } from '../build/esm/index.js'; | ||
| import { getCurrentScope, getGlobalScope, getIsolationScope, init, startSpan } from '../build/esm/index.js'; | ||
|
|
||
| function resetGlobals(): void { | ||
| getCurrentScope().clear(); | ||
|
|
@@ -65,10 +65,11 @@ Deno.test('denoMysqlIntegration: included in default integrations (Deno 2.8.0+)' | |
| // import inside the entry graph in Deno 2.8.0 through 2.8.2. | ||
| // TODO: revisit a `--import` or `--preload` approach once Deno 2.8.3 ships. | ||
| Deno.test('@sentry/deno/import: transforms mysql so it publishes the orchestrion channel', async () => { | ||
| const scenario = new URL('./orchestrion-mysql/scenario.mjs', import.meta.url); | ||
| const scenario = new URL('./scenario.mjs', import.meta.url); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. l: For this PR its alright, but it feels like if we add more test cases it would be nice if we have a helper for the execution of the scenario. |
||
|
|
||
| // packages/deno — where node_modules resolves | ||
| const cwd = new URL('../', import.meta.url); | ||
| // The package root — where `node_modules` (and thus `@sentry/deno` / `mysql`) | ||
| // resolves for the spawned `deno run`. | ||
| const cwd = new URL('../../', import.meta.url); | ||
|
|
||
| const command = new Deno.Command('deno', { | ||
| args: ['run', '--allow-all', scenario.pathname], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "extends": "../../tsconfig.json", | ||
| "include": ["suites/**/*"], | ||
| "compilerOptions": { | ||
| "lib": ["esnext"], | ||
| "target": "esnext" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,9 +31,6 @@ | |
| "@sentry/core": "10.62.0", | ||
| "@sentry/server-utils": "10.62.0" | ||
| }, | ||
| "devDependencies": { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. farewell devDependency 👋 |
||
| "mysql": "^2.18.1" | ||
| }, | ||
| "scripts": { | ||
| "deno-types": "node ./scripts/download-deno-types.mjs", | ||
| "build": "run-s build:transpile build:types", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Could you add this folder into the
CODEOWNERSfile?