Skip to content

Commit

Permalink
chore: replace lolex with sinon fake-timers (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Nov 20, 2023
1 parent 341dfe8 commit 81953c6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
43 changes: 20 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -37,16 +37,17 @@
"@octokit/auth-app": "^6.0.0",
"@octokit/auth-oauth-app": "^7.0.0",
"@octokit/tsconfig": "^2.0.0",
"@sinonjs/fake-timers": "^11.2.2",
"@types/fetch-mock": "^7.3.1",
"@types/jest": "^29.0.0",
"@types/lolex": "^5.1.0",
"@types/node": "^20.0.0",
"@types/sinonjs__fake-timers": "^8.1.5",
"esbuild": "^0.19.0",
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
"glob": "^10.2.5",
"http-proxy-agent": "^7.0.0",
"jest": "^29.0.0",
"lolex": "^6.0.0",
"prettier": "3.1.0",
"proxy": "^2.0.0",
"semantic-release": "^22.0.0",
Expand Down
6 changes: 3 additions & 3 deletions test/auth.test.ts
Expand Up @@ -3,7 +3,7 @@ import fetchMock from "fetch-mock";
import { createAppAuth } from "@octokit/auth-app";
import { createActionAuth } from "@octokit/auth-action";
import { createOAuthAppAuth } from "@octokit/auth-oauth-app";
import lolex, { type Clock } from "lolex";
import { install as installFakeTimers, type Clock } from "@sinonjs/fake-timers";

import { Octokit } from "../src";

Expand Down Expand Up @@ -50,9 +50,9 @@ beforeAll(() => {
Math.random = jest.fn().mockReturnValue(0.123);

// A timestamp is added to the default token note, e.g.
// "octokit 2019-07-04 4feornbt361". Lolex mocks the Date class so
// "octokit 2019-07-04 4feornbt361". sinon-fake-timers mocks the Date class so
// `new Date()` always returns `new Date(0)` by default.
clock = lolex.install({
clock = installFakeTimers({
now: 0,
toFake: ["Date"],
});
Expand Down

0 comments on commit 81953c6

Please sign in to comment.