Skip to content

Commit 64bc208

Browse files
betegonclaude
andcommitted
test: save/restore SENTRY_HOST in URL integration tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c344d06 commit 64bc208

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

test/commands/event/view.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,16 @@ describe("parsePositionalArgs", () => {
158158
});
159159
});
160160

161-
// URL integration tests — applySentryUrlContext may set SENTRY_URL as a side effect
161+
// URL integration tests — applySentryUrlContext may set SENTRY_HOST/SENTRY_URL as a side effect
162162
describe("Sentry URL inputs", () => {
163163
let savedSentryUrl: string | undefined;
164+
let savedSentryHost: string | undefined;
164165

165166
beforeEach(() => {
166167
savedSentryUrl = process.env.SENTRY_URL;
168+
savedSentryHost = process.env.SENTRY_HOST;
167169
delete process.env.SENTRY_URL;
170+
delete process.env.SENTRY_HOST;
168171
});
169172

170173
afterEach(() => {
@@ -173,6 +176,11 @@ describe("parsePositionalArgs", () => {
173176
} else {
174177
delete process.env.SENTRY_URL;
175178
}
179+
if (savedSentryHost !== undefined) {
180+
process.env.SENTRY_HOST = savedSentryHost;
181+
} else {
182+
delete process.env.SENTRY_HOST;
183+
}
176184
});
177185

178186
test("event URL extracts eventId and passes org as OrgAll target", () => {

test/lib/arg-parsing.test.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,16 @@ describe("parseOrgProjectArg", () => {
109109
});
110110
});
111111

112-
// URL integration tests — applySentryUrlContext may set SENTRY_URL as a side effect
112+
// URL integration tests — applySentryUrlContext may set SENTRY_HOST/SENTRY_URL as a side effect
113113
describe("Sentry URL inputs", () => {
114114
let savedSentryUrl: string | undefined;
115+
let savedSentryHost: string | undefined;
115116

116117
beforeEach(() => {
117118
savedSentryUrl = process.env.SENTRY_URL;
119+
savedSentryHost = process.env.SENTRY_HOST;
118120
delete process.env.SENTRY_URL;
121+
delete process.env.SENTRY_HOST;
119122
});
120123

121124
afterEach(() => {
@@ -124,6 +127,11 @@ describe("parseOrgProjectArg", () => {
124127
} else {
125128
delete process.env.SENTRY_URL;
126129
}
130+
if (savedSentryHost !== undefined) {
131+
process.env.SENTRY_HOST = savedSentryHost;
132+
} else {
133+
delete process.env.SENTRY_HOST;
134+
}
127135
});
128136

129137
test("issue URL returns org-all", () => {
@@ -228,13 +236,16 @@ describe("parseIssueArg", () => {
228236
});
229237
});
230238

231-
// URL integration tests — applySentryUrlContext may set SENTRY_URL as a side effect
239+
// URL integration tests — applySentryUrlContext may set SENTRY_HOST/SENTRY_URL as a side effect
232240
describe("Sentry URL inputs", () => {
233241
let savedSentryUrl: string | undefined;
242+
let savedSentryHost: string | undefined;
234243

235244
beforeEach(() => {
236245
savedSentryUrl = process.env.SENTRY_URL;
246+
savedSentryHost = process.env.SENTRY_HOST;
237247
delete process.env.SENTRY_URL;
248+
delete process.env.SENTRY_HOST;
238249
});
239250

240251
afterEach(() => {
@@ -243,6 +254,11 @@ describe("parseIssueArg", () => {
243254
} else {
244255
delete process.env.SENTRY_URL;
245256
}
257+
if (savedSentryHost !== undefined) {
258+
process.env.SENTRY_HOST = savedSentryHost;
259+
} else {
260+
delete process.env.SENTRY_HOST;
261+
}
246262
});
247263

248264
test("issue URL with numeric ID returns explicit-org-numeric", () => {

0 commit comments

Comments
 (0)