From fd87744a46d11b1ef7338e84a5106684a75464ed Mon Sep 17 00:00:00 2001 From: Emma Casolin Date: Mon, 8 Aug 2022 15:40:28 +1000 Subject: [PATCH] style: restricted use of `global` as a global variable `globalThis` is the correct name, so introduced an eslint rule to restrict using `global` --- .eslintrc | 1 + tests/agent/GRPCClientAgent.test.ts | 2 +- tests/agent/service/nodesChainDataGet.test.ts | 2 +- .../service/nodesClosestLocalNode.test.ts | 2 +- .../agent/service/nodesCrossSignClaim.test.ts | 2 +- .../service/nodesHolePunchMessage.test.ts | 2 +- tests/agent/service/notificationsSend.test.ts | 2 +- tests/bin/agent/start.test.ts | 28 +++++++++---------- tests/bin/agent/status.test.ts | 4 +-- tests/bin/agent/stop.test.ts | 10 +++---- tests/bin/bootstrap.test.ts | 12 ++++---- .../allowDisallowPermissions.test.ts | 2 +- .../authenticateAuthenticated.test.ts | 2 +- tests/bin/identities/claim.test.ts | 2 +- tests/bin/identities/discoverGet.test.ts | 2 +- tests/bin/identities/search.test.ts | 2 +- tests/bin/identities/trustUntrustList.test.ts | 6 ++-- tests/bin/keys/renew.test.ts | 4 +-- tests/bin/keys/reset.test.ts | 4 +-- tests/bin/nodes/add.test.ts | 2 +- tests/bin/nodes/claim.test.ts | 2 +- tests/bin/nodes/find.test.ts | 4 +-- tests/bin/nodes/ping.test.ts | 2 +- tests/bin/notifications/sendReadClear.test.ts | 4 +-- tests/bin/secrets/secrets.test.ts | 6 ++-- tests/bin/sessions.test.ts | 2 +- tests/bin/vaults/vaults.test.ts | 8 +++--- .../gestaltsGestaltTrustByNode.test.ts | 2 +- tests/client/service/vaultsLog.test.ts | 2 +- tests/grpc/utils.test.ts | 2 +- tests/keys/KeyManager.test.ts | 4 +-- tests/keys/utils.test.ts | 2 +- tests/nat/DMZ.test.ts | 6 ++-- tests/nat/endpointDependentNAT.test.ts | 8 +++--- tests/nat/endpointIndependentNAT.test.ts | 10 +++---- tests/nodes/NodeConnection.test.ts | 6 ++-- .../NodeConnectionManager.general.test.ts | 4 +-- .../NodeConnectionManager.seednodes.test.ts | 2 +- tests/nodes/NodeManager.test.ts | 4 +-- .../NotificationsManager.test.ts | 2 +- tests/setupAfterEnv.ts | 2 +- tests/utils/exec.ts | 26 +++++++++-------- tests/utils/utils.ts | 6 ++-- tests/vaults/VaultInternal.test.ts | 6 ++-- tests/vaults/VaultManager.test.ts | 12 ++++---- tests/vaults/VaultOps.test.ts | 12 ++++---- 46 files changed, 123 insertions(+), 116 deletions(-) diff --git a/.eslintrc b/.eslintrc index 85ab771bd3..6b9665a16e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,6 +23,7 @@ "rules": { "linebreak-style": ["error", "unix"], "no-empty": 1, + "no-restricted-globals": ["error", "window", "global"], "no-useless-catch": 1, "no-prototype-builtins": 1, "no-constant-condition": 0, diff --git a/tests/agent/GRPCClientAgent.test.ts b/tests/agent/GRPCClientAgent.test.ts index 0cf1fac2f8..9108fb9911 100644 --- a/tests/agent/GRPCClientAgent.test.ts +++ b/tests/agent/GRPCClientAgent.test.ts @@ -169,7 +169,7 @@ describe(GRPCClientAgent.name, () => { serverHost: host, serverPort: port, }); - }, global.defaultTimeout); + }, globalThis.defaultTimeout); afterEach(async () => { await testAgentUtils.closeTestAgentClient(client); await testAgentUtils.closeTestAgentServer(server); diff --git a/tests/agent/service/nodesChainDataGet.test.ts b/tests/agent/service/nodesChainDataGet.test.ts index ffd2fc45f2..7d1385f08d 100644 --- a/tests/agent/service/nodesChainDataGet.test.ts +++ b/tests/agent/service/nodesChainDataGet.test.ts @@ -61,7 +61,7 @@ describe('nodesClosestLocalNode', () => { port: grpcServer.getPort(), logger, }); - }, global.defaultTimeout); + }, globalThis.defaultTimeout); afterEach(async () => { await grpcClient.destroy(); await grpcServer.stop(); diff --git a/tests/agent/service/nodesClosestLocalNode.test.ts b/tests/agent/service/nodesClosestLocalNode.test.ts index a590402490..31d46899f5 100644 --- a/tests/agent/service/nodesClosestLocalNode.test.ts +++ b/tests/agent/service/nodesClosestLocalNode.test.ts @@ -61,7 +61,7 @@ describe('nodesChainDataGet', () => { port: grpcServer.getPort(), logger, }); - }, global.defaultTimeout); + }, globalThis.defaultTimeout); afterEach(async () => { await grpcClient.destroy(); await grpcServer.stop(); diff --git a/tests/agent/service/nodesCrossSignClaim.test.ts b/tests/agent/service/nodesCrossSignClaim.test.ts index 443a134ea5..994ccd391e 100644 --- a/tests/agent/service/nodesCrossSignClaim.test.ts +++ b/tests/agent/service/nodesCrossSignClaim.test.ts @@ -84,7 +84,7 @@ describe('nodesCrossSignClaim', () => { port: grpcServer.getPort(), logger, }); - }, global.defaultTimeout); + }, globalThis.defaultTimeout); afterEach(async () => { await grpcClient.destroy(); await grpcServer.stop(); diff --git a/tests/agent/service/nodesHolePunchMessage.test.ts b/tests/agent/service/nodesHolePunchMessage.test.ts index 8778b82568..1e692ff4a0 100644 --- a/tests/agent/service/nodesHolePunchMessage.test.ts +++ b/tests/agent/service/nodesHolePunchMessage.test.ts @@ -61,7 +61,7 @@ describe('nodesHolePunchMessage', () => { port: grpcServer.getPort(), logger, }); - }, global.defaultTimeout); + }, globalThis.defaultTimeout); afterEach(async () => { await grpcClient.destroy(); await grpcServer.stop(); diff --git a/tests/agent/service/notificationsSend.test.ts b/tests/agent/service/notificationsSend.test.ts index c8575912b9..2c1d4914bb 100644 --- a/tests/agent/service/notificationsSend.test.ts +++ b/tests/agent/service/notificationsSend.test.ts @@ -156,7 +156,7 @@ describe('notificationsSend', () => { port: grpcServer.getPort(), logger, }); - }, global.defaultTimeout); + }, globalThis.defaultTimeout); afterEach(async () => { await grpcClient.destroy(); await grpcServer.stop(); diff --git a/tests/bin/agent/start.test.ts b/tests/bin/agent/start.test.ts index 583dfd5abd..1fc2bb39ec 100644 --- a/tests/bin/agent/start.test.ts +++ b/tests/bin/agent/start.test.ts @@ -21,7 +21,7 @@ describe('start', () => { let dataDir: string; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); }); afterEach(async () => { @@ -99,7 +99,7 @@ describe('start', () => { const statusInfo = (await status.waitFor('DEAD'))!; expect(statusInfo.status).toBe('DEAD'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms()( 'start in background', @@ -202,7 +202,7 @@ describe('start', () => { const statusInfo2 = await status.waitFor('DEAD'); expect(statusInfo2.status).toBe('DEAD'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'concurrent starts results in 1 success', @@ -298,7 +298,7 @@ describe('start', () => { agentProcess1.kill('SIGQUIT'); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'concurrent with bootstrap results in 1 success', @@ -388,7 +388,7 @@ describe('start', () => { agentProcess.kill('SIGTERM'); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'start with existing state', @@ -462,7 +462,7 @@ describe('start', () => { const statusInfo = (await status.waitFor('DEAD'))!; expect(statusInfo.status).toBe('DEAD'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'start when interrupted, requires fresh on next start', @@ -573,7 +573,7 @@ describe('start', () => { const statusInfo = (await status.readStatus())!; expect(statusInfo.status).toBe('DEAD'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'start from recovery code', @@ -715,7 +715,7 @@ describe('start', () => { agentProcess4.kill('SIGTERM'); await execUtils.processExit(agentProcess4); }, - global.defaultTimeout * 3, + globalThis.defaultTimeout * 3, ); runTestIfPlatforms('docker')( 'start with network configuration', @@ -770,7 +770,7 @@ describe('start', () => { // Check for graceful exit await status.waitFor('DEAD'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'start with PK_ROOT_KEY env override', @@ -810,7 +810,7 @@ describe('start', () => { // Check for graceful exit await status.waitFor('DEAD'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'start with --root-key-file override', @@ -861,7 +861,7 @@ describe('start', () => { // Check for graceful exit await status.waitFor('DEAD'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runDescribeIfPlatforms()('start with global agent', () => { let agentDataDir; @@ -878,7 +878,7 @@ describe('start', () => { beforeEach(async () => { // Additional seed node agentDataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); ({ agentStatus: agent1Status, agentClose: agent1Close } = await execUtils.setupTestAgent(globalRootKeyPems[0], logger)); @@ -962,7 +962,7 @@ describe('start', () => { mockedConfigDefaultsNetwork.mockRestore(); await status.waitFor('DEAD'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'start with seed nodes environment variable', @@ -1025,7 +1025,7 @@ describe('start', () => { mockedConfigDefaultsNetwork.mockRestore(); await status.waitFor('DEAD'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); }); diff --git a/tests/bin/agent/status.test.ts b/tests/bin/agent/status.test.ts index 5e885f9543..1d02d0a6a4 100644 --- a/tests/bin/agent/status.test.ts +++ b/tests/bin/agent/status.test.ts @@ -15,7 +15,7 @@ describe('status', () => { let dataDir: string; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); }); afterEach(async () => { @@ -116,7 +116,7 @@ describe('status', () => { status: 'DEAD', }); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')('status on missing agent', async () => { const { exitCode, stdout } = await execUtils.pkExec( diff --git a/tests/bin/agent/stop.test.ts b/tests/bin/agent/stop.test.ts index 83a6cc0d4a..679a1868a5 100644 --- a/tests/bin/agent/stop.test.ts +++ b/tests/bin/agent/stop.test.ts @@ -15,7 +15,7 @@ describe('stop', () => { let dataDir: string; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.testDir, 'polykey-test-'), + path.join(globalThis.testDir, 'polykey-test-'), ); }); afterEach(async () => { @@ -71,7 +71,7 @@ describe('stop', () => { await sleep(5000); agentProcess.kill(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'stopping is idempotent during concurrent calls and STOPPING or DEAD status', @@ -163,7 +163,7 @@ describe('stop', () => { expect(agentStop4.exitCode).toBe(0); agentProcess.kill(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms()( 'stopping starting agent results in error', @@ -227,7 +227,7 @@ describe('stop', () => { await status.waitFor('DEAD'); agentProcess.kill(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'stopping while unauthenticated does not stop', @@ -290,6 +290,6 @@ describe('stop', () => { await status.waitFor('DEAD'); agentProcess.kill(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); diff --git a/tests/bin/bootstrap.test.ts b/tests/bin/bootstrap.test.ts index 53aecd4f64..d968be0c18 100644 --- a/tests/bin/bootstrap.test.ts +++ b/tests/bin/bootstrap.test.ts @@ -15,7 +15,7 @@ describe('bootstrap', () => { let dataDir: string; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); }); afterEach(async () => { @@ -53,7 +53,7 @@ describe('bootstrap', () => { recoveryCode.split(' ').length === 24, ).toBe(true); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'bootstraps node state from provided private key', @@ -96,7 +96,7 @@ describe('bootstrap', () => { ); expect(exitCode2).toBe(0); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'bootstrapping occupied node state', @@ -152,7 +152,7 @@ describe('bootstrap', () => { recoveryCode.split(' ').length === 24, ).toBe(true); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'concurrent bootstrapping results in 1 success', @@ -237,7 +237,7 @@ describe('bootstrap', () => { expect(exitCode2).toBe(0); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms('docker')( 'bootstrap when interrupted, requires fresh on next bootstrap', @@ -314,6 +314,6 @@ describe('bootstrap', () => { recoveryCode.split(' ').length === 24, ).toBe(true); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); diff --git a/tests/bin/identities/allowDisallowPermissions.test.ts b/tests/bin/identities/allowDisallowPermissions.test.ts index 4ab671e2ed..a69614a3e4 100644 --- a/tests/bin/identities/allowDisallowPermissions.test.ts +++ b/tests/bin/identities/allowDisallowPermissions.test.ts @@ -37,7 +37,7 @@ describe('allow/disallow/permissions', () => { let nodePort: Port; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'polykey'); pkAgent = await PolykeyAgent.createPolykeyAgent({ diff --git a/tests/bin/identities/authenticateAuthenticated.test.ts b/tests/bin/identities/authenticateAuthenticated.test.ts index 48d14cdf90..a49cb4091b 100644 --- a/tests/bin/identities/authenticateAuthenticated.test.ts +++ b/tests/bin/identities/authenticateAuthenticated.test.ts @@ -26,7 +26,7 @@ describe('authenticate/authenticated', () => { let testProvider: TestProvider; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'polykey'); // Cannot use global shared agent since we need to register a provider diff --git a/tests/bin/identities/claim.test.ts b/tests/bin/identities/claim.test.ts index cd0aea7815..ed972ed697 100644 --- a/tests/bin/identities/claim.test.ts +++ b/tests/bin/identities/claim.test.ts @@ -28,7 +28,7 @@ describe('claim', () => { let testProvider: TestProvider; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'polykey'); // Cannot use global shared agent since we need to register a provider diff --git a/tests/bin/identities/discoverGet.test.ts b/tests/bin/identities/discoverGet.test.ts index 5594a13ae4..49191a93dc 100644 --- a/tests/bin/identities/discoverGet.test.ts +++ b/tests/bin/identities/discoverGet.test.ts @@ -40,7 +40,7 @@ describe('discover/get', () => { let nodeAPort: Port; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); // Setup the remote gestalt state here // Setting up remote nodes diff --git a/tests/bin/identities/search.test.ts b/tests/bin/identities/search.test.ts index 312206537d..14e7a9dc48 100644 --- a/tests/bin/identities/search.test.ts +++ b/tests/bin/identities/search.test.ts @@ -110,7 +110,7 @@ describe('search', () => { let pkAgent: PolykeyAgent; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'polykey'); // Cannot use global shared agent since we need to register a provider diff --git a/tests/bin/identities/trustUntrustList.test.ts b/tests/bin/identities/trustUntrustList.test.ts index 37b44e645c..8cba3d261c 100644 --- a/tests/bin/identities/trustUntrustList.test.ts +++ b/tests/bin/identities/trustUntrustList.test.ts @@ -36,7 +36,7 @@ describe('trust/untrust/list', () => { let nodePort: Port; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'polykey'); pkAgent = await PolykeyAgent.createPolykeyAgent({ @@ -225,7 +225,7 @@ describe('trust/untrust/list', () => { // @ts-ignore - get protected property pkAgent.discovery.visitedVertices.clear(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms()( 'trusts and untrusts a gestalt by identity, adds it to the gestalt graph, and lists the gestalt with notify permission', @@ -370,7 +370,7 @@ describe('trust/untrust/list', () => { // @ts-ignore - get protected property pkAgent.discovery.visitedVertices.clear(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); runTestIfPlatforms()('should fail on invalid inputs', async () => { let exitCode; diff --git a/tests/bin/keys/renew.test.ts b/tests/bin/keys/renew.test.ts index 8b99f7ae7e..40ab953066 100644 --- a/tests/bin/keys/renew.test.ts +++ b/tests/bin/keys/renew.test.ts @@ -28,7 +28,7 @@ describe('renew', () => { .mockResolvedValueOnce(globalKeyPair) .mockResolvedValue(newKeyPair); dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'polykey'); pkAgent = await PolykeyAgent.createPolykeyAgent({ @@ -42,7 +42,7 @@ describe('renew', () => { }, logger, }); - }, global.defaultTimeout * 2); + }, globalThis.defaultTimeout * 2); afterAll(async () => { await pkAgent.stop(); await fs.promises.rm(dataDir, { diff --git a/tests/bin/keys/reset.test.ts b/tests/bin/keys/reset.test.ts index ba205bf082..200fb28176 100644 --- a/tests/bin/keys/reset.test.ts +++ b/tests/bin/keys/reset.test.ts @@ -28,7 +28,7 @@ describe('reset', () => { .mockResolvedValueOnce(globalKeyPair) .mockResolvedValue(newKeyPair); dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'polykey'); pkAgent = await PolykeyAgent.createPolykeyAgent({ @@ -42,7 +42,7 @@ describe('reset', () => { }, logger, }); - }, global.defaultTimeout * 2); + }, globalThis.defaultTimeout * 2); afterAll(async () => { await pkAgent.stop(); await fs.promises.rm(dataDir, { diff --git a/tests/bin/nodes/add.test.ts b/tests/bin/nodes/add.test.ts index 87f57f7603..3c042e2388 100644 --- a/tests/bin/nodes/add.test.ts +++ b/tests/bin/nodes/add.test.ts @@ -27,7 +27,7 @@ describe('add', () => { let mockedPingNode: jest.SpyInstance; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'polykey'); mockedPingNode = jest.spyOn(NodeManager.prototype, 'pingNode'); diff --git a/tests/bin/nodes/claim.test.ts b/tests/bin/nodes/claim.test.ts index 66d3cfd8bf..f24aca18ce 100644 --- a/tests/bin/nodes/claim.test.ts +++ b/tests/bin/nodes/claim.test.ts @@ -22,7 +22,7 @@ describe('claim', () => { let remoteIdEncoded: NodeIdEncoded; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'keynode'); pkAgent = await PolykeyAgent.createPolykeyAgent({ diff --git a/tests/bin/nodes/find.test.ts b/tests/bin/nodes/find.test.ts index 2bc744bb60..1c6b914da9 100644 --- a/tests/bin/nodes/find.test.ts +++ b/tests/bin/nodes/find.test.ts @@ -27,7 +27,7 @@ describe('find', () => { let remoteOfflinePort: Port; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'keynode'); polykeyAgent = await PolykeyAgent.createPolykeyAgent({ @@ -186,6 +186,6 @@ describe('find', () => { port: 0, }); }, - global.failedConnectionTimeout, + globalThis.failedConnectionTimeout, ); }); diff --git a/tests/bin/nodes/ping.test.ts b/tests/bin/nodes/ping.test.ts index ec3f74121a..ede7afce47 100644 --- a/tests/bin/nodes/ping.test.ts +++ b/tests/bin/nodes/ping.test.ts @@ -23,7 +23,7 @@ describe('ping', () => { let remoteOfflineNodeId: NodeId; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); nodePath = path.join(dataDir, 'keynode'); polykeyAgent = await PolykeyAgent.createPolykeyAgent({ diff --git a/tests/bin/notifications/sendReadClear.test.ts b/tests/bin/notifications/sendReadClear.test.ts index 269c56471b..f0cbf7a89b 100644 --- a/tests/bin/notifications/sendReadClear.test.ts +++ b/tests/bin/notifications/sendReadClear.test.ts @@ -31,7 +31,7 @@ describe('send/read/claim', () => { let receiverAgentPassword: string; beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); // Cannot use the shared global agent since we can't 'un-add' a node // which we need in order to trust it and send notifications to it @@ -314,6 +314,6 @@ describe('send/read/claim', () => { .map(JSON.parse); expect(readNotifications).toHaveLength(0); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); diff --git a/tests/bin/secrets/secrets.test.ts b/tests/bin/secrets/secrets.test.ts index 4f864f1dc7..4155f37926 100644 --- a/tests/bin/secrets/secrets.test.ts +++ b/tests/bin/secrets/secrets.test.ts @@ -18,7 +18,7 @@ describe('CLI secrets', () => { beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); passwordFile = path.join(dataDir, 'passwordFile'); await fs.promises.writeFile(passwordFile, 'password'); @@ -80,7 +80,7 @@ describe('CLI secrets', () => { ).toStrictEqual('this is a secret'); }); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); describe('commandDeleteSecret', () => { @@ -147,7 +147,7 @@ describe('CLI secrets', () => { }); expect(result.exitCode).toBe(0); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); describe('commandNewDir', () => { diff --git a/tests/bin/sessions.test.ts b/tests/bin/sessions.test.ts index e193ac110a..07867c6be2 100644 --- a/tests/bin/sessions.test.ts +++ b/tests/bin/sessions.test.ts @@ -33,7 +33,7 @@ describe('sessions', () => { logger, )); dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); }); afterEach(async () => { diff --git a/tests/bin/vaults/vaults.test.ts b/tests/bin/vaults/vaults.test.ts index 0f315a73fb..5f020cd5d0 100644 --- a/tests/bin/vaults/vaults.test.ts +++ b/tests/bin/vaults/vaults.test.ts @@ -52,7 +52,7 @@ describe('CLI vaults', () => { beforeEach(async () => { dataDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); passwordFile = path.join(dataDir, 'passwordFile'); await fs.promises.writeFile(passwordFile, 'password'); @@ -208,7 +208,7 @@ describe('CLI vaults', () => { 'should clone and pull a vault', async () => { const dataDir2 = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); const targetPolykeyAgent = await PolykeyAgent.createPolykeyAgent({ password, @@ -376,7 +376,7 @@ describe('CLI vaults', () => { recursive: true, }); }, - global.defaultTimeout * 3, + globalThis.defaultTimeout * 3, ); describe('commandShare', () => { runTestIfPlatforms()('Should share a vault', async () => { @@ -876,7 +876,7 @@ describe('CLI vaults', () => { await remoteOnline?.destroy(); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); }); diff --git a/tests/client/service/gestaltsGestaltTrustByNode.test.ts b/tests/client/service/gestaltsGestaltTrustByNode.test.ts index d18a0e0a23..e883c52494 100644 --- a/tests/client/service/gestaltsGestaltTrustByNode.test.ts +++ b/tests/client/service/gestaltsGestaltTrustByNode.test.ts @@ -90,7 +90,7 @@ describe('gestaltsGestaltTrustByNode', () => { const claim = claimsUtils.decodeClaim(claimEncoded); nodeChainData[claimId] = claim; await testProvider.publishClaim(connectedIdentity, claim); - }, global.maxTimeout); + }, globalThis.maxTimeout); afterAll(async () => { await node.stop(); await fs.promises.rm(nodeDataDir, { diff --git a/tests/client/service/vaultsLog.test.ts b/tests/client/service/vaultsLog.test.ts index 60d89b5693..4c1ac5789f 100644 --- a/tests/client/service/vaultsLog.test.ts +++ b/tests/client/service/vaultsLog.test.ts @@ -104,7 +104,7 @@ describe('vaultsLog', () => { port: grpcServer.getPort(), logger, }); - }, global.defaultTimeout * 2); + }, globalThis.defaultTimeout * 2); afterEach(async () => { await grpcClient.destroy(); await grpcServer.stop(); diff --git a/tests/grpc/utils.test.ts b/tests/grpc/utils.test.ts index 53f5658801..ee0c8c6d27 100644 --- a/tests/grpc/utils.test.ts +++ b/tests/grpc/utils.test.ts @@ -23,7 +23,7 @@ describe('GRPC utils', () => { metaServer; [server, port] = await utils.openTestServer(authenticate, logger); client = await utils.openTestClient(port); - }, global.defaultTimeout); + }, globalThis.defaultTimeout); afterAll(async () => { utils.closeTestClient(client); setTimeout(() => { diff --git a/tests/keys/KeyManager.test.ts b/tests/keys/KeyManager.test.ts index dfd312fda0..776949df4c 100644 --- a/tests/keys/KeyManager.test.ts +++ b/tests/keys/KeyManager.test.ts @@ -127,7 +127,7 @@ describe('KeyManager', () => { expect(keyManager.getNodeId()).toStrictEqual(nodeId); await keyManager.stop(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'create deterministic keypair with recovery code', @@ -159,7 +159,7 @@ describe('KeyManager', () => { await keyManager2.stop(); expect(nodeId1).toStrictEqual(nodeId2); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test('override key generation with privateKeyOverride', async () => { const keysPath = `${dataDir}/keys`; diff --git a/tests/keys/utils.test.ts b/tests/keys/utils.test.ts index 7a2f728dbf..18d916d39f 100644 --- a/tests/keys/utils.test.ts +++ b/tests/keys/utils.test.ts @@ -95,6 +95,6 @@ describe('utils', () => { const nodeId2 = keysUtils.publicKeyToNodeId(keyPair2.publicKey); expect(nodeId1).toStrictEqual(nodeId2); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); diff --git a/tests/nat/DMZ.test.ts b/tests/nat/DMZ.test.ts index 1e01997c49..cd883a8dce 100644 --- a/tests/nat/DMZ.test.ts +++ b/tests/nat/DMZ.test.ts @@ -113,7 +113,7 @@ runDescribeIf( expect(exitCode).toBe(null); expect(signal).toBe('SIGTERM'); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'agents in different namespaces can ping each other', @@ -232,7 +232,7 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'agents in different namespaces can ping each other via seed node', @@ -303,6 +303,6 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); diff --git a/tests/nat/endpointDependentNAT.test.ts b/tests/nat/endpointDependentNAT.test.ts index 8ce7ffed71..e2df0c01ee 100644 --- a/tests/nat/endpointDependentNAT.test.ts +++ b/tests/nat/endpointDependentNAT.test.ts @@ -89,7 +89,7 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'node1 connects to node2 behind EDM NAT', @@ -175,7 +175,7 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'node1 behind EDM NAT cannot connect to node2 behind EDM NAT', @@ -239,7 +239,7 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'node1 behind EDM NAT cannot connect to node2 behind EIM NAT', @@ -300,6 +300,6 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); diff --git a/tests/nat/endpointIndependentNAT.test.ts b/tests/nat/endpointIndependentNAT.test.ts index fb7e44077a..aacd6c99e3 100644 --- a/tests/nat/endpointIndependentNAT.test.ts +++ b/tests/nat/endpointIndependentNAT.test.ts @@ -89,7 +89,7 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'node1 connects to node2 behind EIM NAT', @@ -220,7 +220,7 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'node1 behind EIM NAT connects to node2 behind EIM NAT', @@ -351,7 +351,7 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'node1 behind EIM NAT connects to node2 behind EIM NAT via seed node', @@ -413,7 +413,7 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'node1 behind EIM NAT cannot connect to node2 behind EDM NAT', @@ -474,6 +474,6 @@ runDescribeIf( }); await tearDownNAT(); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); diff --git a/tests/nodes/NodeConnection.test.ts b/tests/nodes/NodeConnection.test.ts index 8391f6f7dc..ee0c25c9e0 100644 --- a/tests/nodes/NodeConnection.test.ts +++ b/tests/nodes/NodeConnection.test.ts @@ -351,7 +351,7 @@ describe(`${NodeConnection.name} test`, () => { keyPrivatePem: globalRootKeyPems[0], certChainPem: keysUtils.certToPem(cert), }; - }, global.polykeyStartupTimeout * 2); + }, globalThis.polykeyStartupTimeout * 2); afterEach(async () => { await clientProxy.stop(); @@ -791,7 +791,7 @@ describe(`${NodeConnection.name} test`, () => { await nodeConnection?.destroy(); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test.each(options)( "should call `killSelf and throw if the server %s's during testStreamFail", @@ -860,7 +860,7 @@ describe(`${NodeConnection.name} test`, () => { await nodeConnection?.destroy(); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test('existing connection handles a resetRootKeyPair on sending side', async () => { diff --git a/tests/nodes/NodeConnectionManager.general.test.ts b/tests/nodes/NodeConnectionManager.general.test.ts index 4ab11fd1f1..e3e9a9ba54 100644 --- a/tests/nodes/NodeConnectionManager.general.test.ts +++ b/tests/nodes/NodeConnectionManager.general.test.ts @@ -317,7 +317,7 @@ describe(`${NodeConnectionManager.name} general test`, () => { mockedPingNode.mockRestore(); } }, - global.polykeyStartupTimeout, + globalThis.polykeyStartupTimeout, ); test( 'cannot find node (contacts remote node)', @@ -369,7 +369,7 @@ describe(`${NodeConnectionManager.name} general test`, () => { await nodeConnectionManager.stop(); } }, - global.failedConnectionTimeout * 2, + globalThis.failedConnectionTimeout * 2, ); test('receives 20 closest local nodes from connected target', async () => { let serverPKAgent: PolykeyAgent | undefined; diff --git a/tests/nodes/NodeConnectionManager.seednodes.test.ts b/tests/nodes/NodeConnectionManager.seednodes.test.ts index 1ef6b8b71b..5768cc2f0d 100644 --- a/tests/nodes/NodeConnectionManager.seednodes.test.ts +++ b/tests/nodes/NodeConnectionManager.seednodes.test.ts @@ -549,6 +549,6 @@ describe(`${NodeConnectionManager.name} seed nodes test`, () => { await node2?.destroy(); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); }); diff --git a/tests/nodes/NodeManager.test.ts b/tests/nodes/NodeManager.test.ts index 1f8f0e5b57..b7a2d80597 100644 --- a/tests/nodes/NodeManager.test.ts +++ b/tests/nodes/NodeManager.test.ts @@ -215,7 +215,7 @@ describe(`${NodeManager.name} test`, () => { await server?.destroy(); } }, - global.failedConnectionTimeout * 2, + globalThis.failedConnectionTimeout * 2, ); // Ping needs to timeout (takes 20 seconds + setup + pulldown) test('getPublicKey', async () => { let server: PolykeyAgent | undefined; @@ -329,7 +329,7 @@ describe(`${NodeManager.name} test`, () => { await x.nodeGraph.setNode(yNodeId, yNodeAddress); await y.nodeGraph.setNode(xNodeId, xNodeAddress); - }, global.polykeyStartupTimeout * 2); + }, globalThis.polykeyStartupTimeout * 2); afterAll(async () => { await y.stop(); await x.stop(); diff --git a/tests/notifications/NotificationsManager.test.ts b/tests/notifications/NotificationsManager.test.ts index 7b60e16a78..dc7e2c5c9a 100644 --- a/tests/notifications/NotificationsManager.test.ts +++ b/tests/notifications/NotificationsManager.test.ts @@ -144,7 +144,7 @@ describe('NotificationsManager', () => { host: receiver.proxy.getProxyHost(), port: receiver.proxy.getProxyPort(), }); - }, global.defaultTimeout); + }, globalThis.defaultTimeout); afterEach(async () => { await receiver.stop(); await queue.stop(); diff --git a/tests/setupAfterEnv.ts b/tests/setupAfterEnv.ts index 6d49ee9a57..8ea8279e39 100644 --- a/tests/setupAfterEnv.ts +++ b/tests/setupAfterEnv.ts @@ -1,4 +1,4 @@ // Default timeout per test // some tests may take longer in which case you should specify the timeout // explicitly for each test by using the third parameter of test function -jest.setTimeout(global.defaultTimeout); +jest.setTimeout(globalThis.defaultTimeout); diff --git a/tests/utils/exec.ts b/tests/utils/exec.ts index df5a08ca35..2149122597 100644 --- a/tests/utils/exec.ts +++ b/tests/utils/exec.ts @@ -22,11 +22,11 @@ type ExecOpts = { }; const tsConfigPath = path.resolve( - path.join(global.projectDir, 'tsconfig.json'), + path.join(globalThis.projectDir, 'tsconfig.json'), ); const polykeyPath = path.resolve( - path.join(global.projectDir, 'src/bin/polykey.ts'), + path.join(globalThis.projectDir, 'src/bin/polykey.ts'), ); const generateDockerArgs = (mountPath: string) => [ @@ -114,7 +114,7 @@ async function pkStdio( }> { const cwd = opts.cwd ?? - (await fs.promises.mkdtemp(path.join(global.tmpDir, 'polykey-test-'))); + (await fs.promises.mkdtemp(path.join(globalThis.tmpDir, 'polykey-test-'))); // Recall that we attempt to connect to all specified seed nodes on agent start. // Therefore, for testing purposes only, we default the seed nodes as empty // (if not defined in the env) to ensure no attempted connections. A regular @@ -241,7 +241,7 @@ async function pkExecWithoutShell( }> { const cwd = opts.cwd ?? - (await fs.promises.mkdtemp(path.join(global.tmpDir, 'polykey-test-'))); + (await fs.promises.mkdtemp(path.join(globalThis.tmpDir, 'polykey-test-'))); const env = { ...process.env, ...opts.env, @@ -293,7 +293,9 @@ async function pkExecWithShell( }> { const cwd = path.resolve( opts.cwd ?? - (await fs.promises.mkdtemp(path.join(global.tmpDir, 'polykey-test-'))), + (await fs.promises.mkdtemp( + path.join(globalThis.tmpDir, 'polykey-test-'), + )), ); const env = { ...process.env, @@ -343,7 +345,7 @@ async function pkSpawnWithoutShell( ): Promise { const cwd = opts.cwd ?? - (await fs.promises.mkdtemp(path.join(global.tmpDir, 'polykey-test-'))); + (await fs.promises.mkdtemp(path.join(globalThis.tmpDir, 'polykey-test-'))); const env = { ...process.env, ...opts.env, @@ -383,7 +385,9 @@ async function pkSpawnWithShell( ): Promise { const cwd = path.resolve( opts.cwd ?? - (await fs.promises.mkdtemp(path.join(global.tmpDir, 'polykey-test-'))), + (await fs.promises.mkdtemp( + path.join(globalThis.tmpDir, 'polykey-test-'), + )), ); const env = { ...process.env, @@ -434,7 +438,7 @@ async function pkExpect({ }> { cwd = cwd ?? - (await fs.promises.mkdtemp(path.join(global.tmpDir, 'polykey-test-'))); + (await fs.promises.mkdtemp(path.join(globalThis.tmpDir, 'polykey-test-'))); env = { ...process.env, ...env, @@ -445,10 +449,10 @@ async function pkExpect({ // PolykeyAgent is expected to initially connect to the mainnet seed nodes env['PK_SEED_NODES'] = env['PK_SEED_NODES'] ?? ''; const tsConfigPath = path.resolve( - path.join(global.projectDir, 'tsconfig.json'), + path.join(globalThis.projectDir, 'tsconfig.json'), ); const polykeyPath = path.resolve( - path.join(global.projectDir, 'src/bin/polykey.ts'), + path.join(globalThis.projectDir, 'src/bin/polykey.ts'), ); // Expect chain runs against stdout and stderr let expectChain = nexpect.spawn( @@ -526,7 +530,7 @@ function expectProcessError( */ async function setupTestAgent(privateKeyPem: PrivateKeyPem, logger: Logger) { const agentDir = await fs.promises.mkdtemp( - path.join(global.tmpDir, 'polykey-test-'), + path.join(globalThis.tmpDir, 'polykey-test-'), ); const agentPassword = 'password'; const agentProcess = await pkSpawn( diff --git a/tests/utils/utils.ts b/tests/utils/utils.ts index e5fc92204c..a3062e004b 100644 --- a/tests/utils/utils.ts +++ b/tests/utils/utils.ts @@ -213,7 +213,8 @@ function runDescribeIf(condition: boolean) { */ function runTestIfPlatforms(...platforms: Array) { return runTestIf( - platforms.includes(global.testPlatform) || global.testPlatform == null, + platforms.includes(globalThis.testPlatform) || + globalThis.testPlatform == null, ); } @@ -224,7 +225,8 @@ function runTestIfPlatforms(...platforms: Array) { */ function runDescribeIfPlatforms(...platforms: Array) { return runDescribeIf( - platforms.includes(global.testPlatform) || global.testPlatform == null, + platforms.includes(globalThis.testPlatform) || + globalThis.testPlatform == null, ); } diff --git a/tests/vaults/VaultInternal.test.ts b/tests/vaults/VaultInternal.test.ts index 10cdf1ef50..59757a7b34 100644 --- a/tests/vaults/VaultInternal.test.ts +++ b/tests/vaults/VaultInternal.test.ts @@ -271,7 +271,7 @@ describe('VaultInternal', () => { }); expect(files).toEqual([]); }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test('write operation allowed', async () => { await vault.writeF(async (efs) => { @@ -535,7 +535,7 @@ describe('VaultInternal', () => { return vault.version(fourthCommit); }).rejects.toThrow(); }, - global.defaultTimeout, + globalThis.defaultTimeout, ); test('can recover from dirty state', async () => { await vault.writeF(async (efs) => { @@ -734,7 +734,7 @@ describe('VaultInternal', () => { ).rejects.toThrow(git.Errors.CommitNotFetchedError); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); // Locking tests const waitDelay = 200; diff --git a/tests/vaults/VaultManager.test.ts b/tests/vaults/VaultManager.test.ts index eeea89ef73..3d7ac47782 100644 --- a/tests/vaults/VaultManager.test.ts +++ b/tests/vaults/VaultManager.test.ts @@ -177,7 +177,7 @@ describe('VaultManager', () => { await vaultManager?.destroy(); } }, - global.defaultTimeout * 4, + globalThis.defaultTimeout * 4, ); test('can rename a vault', async () => { const vaultManager = await VaultManager.createVaultManager({ @@ -315,7 +315,7 @@ describe('VaultManager', () => { await vaultManager?.destroy(); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test('cannot concurrently create vaults with the same name', async () => { const vaultManager = await VaultManager.createVaultManager({ @@ -974,7 +974,7 @@ describe('VaultManager', () => { await vaultManager?.destroy(); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test( 'manage pulling from different remotes', @@ -1110,7 +1110,7 @@ describe('VaultManager', () => { await vaultManager?.destroy(); } }, - global.failedConnectionTimeout, + globalThis.failedConnectionTimeout, ); test( 'able to recover metadata after complex operations', @@ -1186,7 +1186,7 @@ describe('VaultManager', () => { await vaultManager?.destroy(); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test('throw when trying to commit to a cloned vault', async () => { const vaultManager = await VaultManager.createVaultManager({ @@ -1384,7 +1384,7 @@ describe('VaultManager', () => { await vaultManager?.destroy(); } }, - global.failedConnectionTimeout, + globalThis.failedConnectionTimeout, ); }); test('handleScanVaults should list all vaults with permissions', async () => { diff --git a/tests/vaults/VaultOps.test.ts b/tests/vaults/VaultOps.test.ts index ee1adb834f..1ff6962437 100644 --- a/tests/vaults/VaultOps.test.ts +++ b/tests/vaults/VaultOps.test.ts @@ -138,7 +138,7 @@ describe('VaultOps', () => { ); } }, - global.defaultTimeout * 4, + globalThis.defaultTimeout * 4, ); test( 'updating secret content', @@ -149,7 +149,7 @@ describe('VaultOps', () => { (await vaultOps.getSecret(vault, 'secret-1')).toString(), ).toStrictEqual('secret-content-change'); }, - global.defaultTimeout * 4, + globalThis.defaultTimeout * 4, ); test('updating secret content within a directory', async () => { await vaultOps.mkdir(vault, path.join('dir-1', 'dir-2'), { @@ -183,7 +183,7 @@ describe('VaultOps', () => { ).toStrictEqual(content); } }, - global.defaultTimeout * 2, + globalThis.defaultTimeout * 2, ); test('deleting a secret', async () => { await vaultOps.addSecret(vault, 'secret-1', 'secret-content'); @@ -236,7 +236,7 @@ describe('VaultOps', () => { ).resolves.not.toContain(name); } }, - global.defaultTimeout * 4, + globalThis.defaultTimeout * 4, ); test('renaming a secret', async () => { await vaultOps.addSecret(vault, 'secret-1', 'secret-content'); @@ -356,7 +356,7 @@ describe('VaultOps', () => { list = await vaultOps.listSecrets(vault); expect(list.sort()).toStrictEqual([].sort()); }, - global.defaultTimeout * 4, + globalThis.defaultTimeout * 4, ); test('adding a directory of 1 secret', async () => { const secretDir = await fs.promises.mkdtemp( @@ -520,6 +520,6 @@ describe('VaultOps', () => { recursive: true, }); }, - global.defaultTimeout * 5, + globalThis.defaultTimeout * 5, ); });