diff --git a/packages/deno/package.json b/packages/deno/package.json index b1e3996e8dfd..99dcec12e7c6 100644 --- a/packages/deno/package.json +++ b/packages/deno/package.json @@ -49,7 +49,8 @@ "lint:fix": "oxlint . --fix --type-aware", "lint:es-compatibility": "es-check es2022 ./build/esm/*.js --module", "install:deno": "node ./scripts/install-deno.mjs", - "test": "run-s install:deno deno-types test:unit", + "test": "run-s install:deno deno-types test:types test:unit", + "test:types": "deno check --unstable-sloppy-imports test", "test:unit": "deno test --allow-net --allow-read --allow-run --allow-env --no-check", "test:unit:update": "deno test --allow-net --allow-read --allow-run --allow-env --no-check --allow-write -- --update", "yalc:publish": "yalc publish --push --sig" diff --git a/packages/deno/test/deno-runtime-metrics.test.ts b/packages/deno/test/deno-runtime-metrics.test.ts index 0dfdc5d35d6a..947cc1777e0f 100644 --- a/packages/deno/test/deno-runtime-metrics.test.ts +++ b/packages/deno/test/deno-runtime-metrics.test.ts @@ -45,7 +45,7 @@ async function collectMetrics( await client.flush(2000); // Stop the collection interval so Deno's leak detector doesn't flag it. - metricsIntegration.teardown?.(); + (metricsIntegration as { teardown?: () => void }).teardown?.(); const items: MetricItem[] = []; for (const envelope of envelopes) { diff --git a/packages/deno/test/opentelemetry.test.ts b/packages/deno/test/opentelemetry.test.ts index 12349ea6a78a..c8847ad3c468 100644 --- a/packages/deno/test/opentelemetry.test.ts +++ b/packages/deno/test/opentelemetry.test.ts @@ -1,5 +1,6 @@ import { getMainCarrier } from '@sentry/core'; import { assertEquals, assertNotEquals } from 'https://deno.land/std@0.212.0/assert/mod.ts'; +import type { TracerProvider } from 'npm:@opentelemetry/api@1'; import { context, propagation, trace } from 'npm:@opentelemetry/api@1'; import type { DenoClient } from '../build/esm/index.js'; import { init, startSpan } from '../build/esm/index.js'; @@ -149,8 +150,8 @@ Deno.test('should override pre-existing OTel provider with Sentry provider', asy resetSdk(); // Simulate a pre-existing OTel registration (e.g. from Supabase Edge Runtime) - const fakeProvider = { getTracer: () => ({}) }; - trace.setGlobalTracerProvider(fakeProvider as any); + const fakeProvider = { getTracer: () => ({}) } as unknown as TracerProvider; + trace.setGlobalTracerProvider(fakeProvider); const transactionEvents: any[] = []; diff --git a/packages/deno/test/sdk.test.ts b/packages/deno/test/sdk.test.ts index fe85e2ff9f45..032442ece005 100644 --- a/packages/deno/test/sdk.test.ts +++ b/packages/deno/test/sdk.test.ts @@ -6,10 +6,11 @@ import { init as initSdk, spanStreamingIntegration, } from '../build/esm/index.js'; +import type { DenoOptions } from '../build/esm/index.js'; 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'; -function init(options) { +function init(options: DenoOptions) { getCurrentScope().setClient(undefined); return initSdk(options); } @@ -40,7 +41,7 @@ Deno.test("doesn't add spanStreamingIntegration if user added it manually", () = }); const integrations = client.getOptions().integrations.filter(i => i.name === 'SpanStreaming'); assertEquals(integrations.length, 1); - assert(!integrations[0].isDefaultInstance); + assert(!(integrations[0] as { isDefaultInstance?: true }).isDefaultInstance); }); Deno.test("doesn't add tracing integrations when tracing is disabled", () => { @@ -73,7 +74,7 @@ Deno.test('getDefaultIntegrations gates the tracing set on the options it is giv }); Deno.test("init doesn't write the computed default integrations back onto the options object", () => { - const options = { dsn: 'https://username@domain/123' }; + const options: DenoOptions = { dsn: 'https://username@domain/123' }; init(options); assertEquals('defaultIntegrations' in options, false); options.tracesSampleRate = 1;