Skip to content

Commit a64794a

Browse files
committed
build(deps-dev): update @types/sinon to 21.0.1 and fix fake timer test leaks
1 parent 4b633d2 commit a64794a

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@
247247
"@types/node": "^25.7.0",
248248
"@types/request": "^2.47.0",
249249
"@types/request-promise": "^4.1.41",
250-
"@types/sinon": "^17.0.2",
250+
"@types/sinon": "^21.0.1",
251251
"@types/sinon-chai": "^3.0.0",
252252
"@types/uuid": "^10.0.0",
253253
"@typescript-eslint/eslint-plugin": "^8.59.3",

test/unit/utils/api-request.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,9 @@ describe('HttpClient', () => {
11011101
});
11021102

11031103
it('should wait when retry-after expressed as a timestamp', () => {
1104-
clock = sinon.useFakeTimers();
1104+
clock = sinon.useFakeTimers({
1105+
toFake: ['Date', 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval']
1106+
});
11051107
clock.setSystemTime(1000);
11061108
const timestamp = new Date(clock.now + 30 * 1000);
11071109

test/unit/utils/jwt.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,10 @@ describe('UrlKeyFetcher', () => {
599599
mockedRequests.push(mockFetchPublicKeys());
600600
mockedRequests.push(mockFetchPublicKeys());
601601

602-
clock = sinon.useFakeTimers(1000);
602+
clock = sinon.useFakeTimers({
603+
now: 1000,
604+
toFake: ['Date', 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval']
605+
});
603606

604607
return keyFetcher.fetchPublicKeys().then(() => {
605608
expect(https.request).to.have.been.calledOnce;
@@ -716,7 +719,10 @@ describe('JwksFetcher', () => {
716719
mockedRequests.push(mockFetchJsonWebKeys());
717720
mockedRequests.push(mockFetchJsonWebKeys());
718721

719-
clock = sinon.useFakeTimers(1000);
722+
clock = sinon.useFakeTimers({
723+
now: 1000,
724+
toFake: ['Date', 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval']
725+
});
720726

721727
return keyFetcher.fetchPublicKeys().then(() => {
722728
expect(https.request).to.have.been.calledOnce;

0 commit comments

Comments
 (0)