Skip to content

Commit bb6e4fc

Browse files
authored
test(credential-provider-cognito-identity): compat for Node.js 18 (#4817)
1 parent 28aae5c commit bb6e4fc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/credential-provider-cognito-identity/src/localStorage.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ describe("localStorage", () => {
1010

1111
beforeEach(() => {
1212
if (window) {
13-
(window.localStorage as any) = undefined;
13+
Object.defineProperty(window, "localStorage", {
14+
writable: true,
15+
configurable: true,
16+
enumerable: true,
17+
value: undefined,
18+
});
1419
}
1520

1621
if (self) {
@@ -20,7 +25,12 @@ describe("localStorage", () => {
2025

2126
afterEach(() => {
2227
if (window) {
23-
(window.localStorage as any) = storageAtInit;
28+
Object.defineProperty(window, "localStorage", {
29+
writable: true,
30+
configurable: true,
31+
enumerable: true,
32+
value: storageAtInit,
33+
});
2434
}
2535

2636
if (self) {

0 commit comments

Comments
 (0)