Skip to content

Commit 443835e

Browse files
test(NODE-5992): fix env var restoration in tests (#4017)
1 parent eab8f23 commit 443835e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: test/integration/auth/mongodb_aws.test.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,17 @@ describe('MONGODB-AWS', function () {
8888
});
8989

9090
describe('with missing aws token', () => {
91-
let awsSessionToken;
91+
let awsSessionToken: string | undefined;
9292

93-
beforeEach(function () {
93+
beforeEach(() => {
9494
awsSessionToken = process.env.AWS_SESSION_TOKEN;
9595
delete process.env.AWS_SESSION_TOKEN;
9696
});
9797

98-
afterEach(async () => {
99-
process.env.AWS_SESSION_TOKEN = awsSessionToken;
98+
afterEach(() => {
99+
if (awsSessionToken != null) {
100+
process.env.AWS_SESSION_TOKEN = awsSessionToken;
101+
}
100102
});
101103

102104
it('should not throw an exception when aws token is missing', async function () {

0 commit comments

Comments
 (0)