Skip to content

Commit b3dc2bd

Browse files
committed
fix(test): reset Sentry SDK state after enabled-path tests
The 'with telemetry enabled' tests call initSentry(true) which sets global SDK state. Without cleanup, Sentry.isEnabled() returns true for all subsequent test files, breaking feedbackCommand's telemetry-disabled assertion.
1 parent 9b79419 commit b3dc2bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/lib/telemetry.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ describe("withTelemetry", () => {
144144
delete process.env[ENV_VAR];
145145
});
146146

147+
afterEach(() => {
148+
// Re-init with enabled=false to reset global SDK state.
149+
// Without this, Sentry.isEnabled() returns true for all
150+
// subsequent test files (e.g. feedbackCommand checks it).
151+
initSentry(false);
152+
});
153+
147154
test("propagates 4xx ApiError through enabled SDK path", async () => {
148155
const error = new ApiError("Not found", 404, "Issue not found");
149156
await expect(

0 commit comments

Comments
 (0)