fix: avoid leaving TZ="undefined" when restoring an unset timezone

process.env coerces assigned values to strings, so
process.env.TZ = originalTZ left the literal string "undefined"
behind (instead of clearing TZ) when it was unset before the test
ran. Delete the var in that case instead of assigning undefined.
This commit is contained in:
Aaron Guise
2026-07-29 13:31:56 +12:00
parent 71565e9328
commit 3108b2f336
+4 -1
View File
@@ -10,7 +10,10 @@ beforeAll(() => {
process.env.TZ = 'UTC';
});
afterAll(() => {
process.env.TZ = originalTZ;
// process.env coerces to strings, so `= undefined` would leave the literal
// string "undefined" behind when TZ was originally unset - delete instead.
if (originalTZ === undefined) delete process.env.TZ;
else process.env.TZ = originalTZ;
});
function makeEmail(overrides: Partial<Email> = {}): Email {