feat(core-shared): Sentry-as-OTel-exporter bridge module
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
|
||||
beforeEach(() => vi.resetModules());
|
||||
|
||||
describe("createSentryOtelBridge", () => {
|
||||
it("returns a span processor when given a DSN", async () => {
|
||||
// Mock @sentry/opentelemetry — we only verify the shape of what the bridge returns.
|
||||
vi.doMock("@sentry/opentelemetry", () => ({
|
||||
SentrySpanProcessor: class {
|
||||
onStart() {}
|
||||
onEnd() {}
|
||||
forceFlush() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
shutdown() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
},
|
||||
}));
|
||||
const { createSentryOtelBridge } = await import("./sentry-bridge");
|
||||
const bridge = createSentryOtelBridge({ dsn: "https://test@sentry.io/1" });
|
||||
expect(bridge.spanProcessor).toBeDefined();
|
||||
// logRecordProcessor is null in Phase 1 — @sentry/opentelemetry 10.x does not
|
||||
// export SentryLogRecordProcessor. It will be wired in Phase 3 via @sentry/node.
|
||||
expect(bridge.logRecordProcessor).toBeNull();
|
||||
});
|
||||
|
||||
it("returns null processors when no DSN provided", async () => {
|
||||
const { createSentryOtelBridge } = await import("./sentry-bridge");
|
||||
const bridge = createSentryOtelBridge({ dsn: "" });
|
||||
expect(bridge.spanProcessor).toBeNull();
|
||||
expect(bridge.logRecordProcessor).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user