Skip to content

Commit 7752bbe

Browse files
authored
maint: modernize devDependencies (#287)
* maint: modernize devDependencies * Switch to vitest * Switch to fetch-mock@11 from custom fork * Remove semantic-release from devDeps * maint: remove vitest ui * style: prettier * test: update inline snapshots * Revert "test: update inline snapshots" This reverts commit b819a31. * fix merge
1 parent 9b4f7bb commit 7752bbe

23 files changed

+1827
-9891
lines changed

package-lock.json

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

package.json

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"lint": "prettier --check '{src,test,scripts}/**/*' README.md package.json",
99
"lint:fix": "prettier --write '{src,test,scripts}/**/*' README.md package.json",
1010
"pretest": "npm run -s lint",
11-
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest --coverage"
11+
"test": "vitest run --coverage"
1212
},
1313
"repository": "https://github.com/octokit/oauth-methods.js",
1414
"keywords": [
@@ -28,53 +28,17 @@
2828
},
2929
"devDependencies": {
3030
"@octokit/tsconfig": "^3.0.0",
31-
"@types/jest": "^29.0.0",
3231
"@types/node": "^22.0.0",
32+
"@vitest/coverage-v8": "^2.0.0",
3333
"esbuild": "^0.24.0",
34-
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
34+
"fetch-mock": "^11.0.0",
3535
"glob": "^11.0.0",
36-
"jest": "^29.0.0",
3736
"prettier": "3.4.2",
38-
"semantic-release": "^24.0.0",
3937
"semantic-release-plugin-update-version-in-files": "^1.1.0",
40-
"ts-jest": "^29.0.0",
41-
"typescript": "^5.0.0"
42-
},
43-
"jest": {
44-
"extensionsToTreatAsEsm": [
45-
".ts"
46-
],
47-
"transform": {
48-
"^.+\\.(ts|tsx)$": [
49-
"ts-jest",
50-
{
51-
"tsconfig": "test/tsconfig.test.json",
52-
"useESM": true
53-
}
54-
]
55-
},
56-
"coverageThreshold": {
57-
"global": {
58-
"statements": 100,
59-
"branches": 100,
60-
"functions": 100,
61-
"lines": 100
62-
}
63-
},
64-
"moduleNameMapper": {
65-
"^(.+)\\.jsx?$": "$1"
66-
}
38+
"typescript": "^5.0.0",
39+
"vitest": "^2.0.0"
6740
},
6841
"release": {
69-
"branches": [
70-
"+([0-9]).x",
71-
"main",
72-
"next",
73-
{
74-
"name": "beta",
75-
"prerelease": true
76-
}
77-
],
7842
"plugins": [
7943
"@semantic-release/commit-analyzer",
8044
"@semantic-release/release-notes-generator",

src/check-token.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ export async function checkToken(
4343
export async function checkToken(
4444
options: CheckTokenOAuthAppOptions | CheckTokenGitHubAppOptions,
4545
): Promise<any> {
46-
const request =
47-
options.request ||
48-
/* istanbul ignore next: we always pass a custom request in tests */
49-
defaultRequest;
46+
/* v8 ignore start: we always pass a custom request in tests */
47+
const request = options.request || defaultRequest;
48+
/* v8 ignore stop */
5049

5150
const response = await request("POST /applications/{client_id}/token", {
5251
headers: {

src/create-device-code.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ export type CreateDeviceCodeDeviceTokenResponse = OctokitResponse<{
2626
export async function createDeviceCode(
2727
options: CreateDeviceCodeOAuthAppOptions | CreateDeviceCodeGitHubAppOptions,
2828
): Promise<CreateDeviceCodeDeviceTokenResponse> {
29-
const request =
30-
options.request ||
31-
/* istanbul ignore next: we always pass a custom request in tests */
32-
defaultRequest;
29+
/* v8 ignore start: we always pass a custom request in tests */
30+
const request = options.request || defaultRequest;
31+
/* v8 ignore stop */
3332

3433
const parameters: Record<string, unknown> = {
3534
client_id: options.clientId,

src/delete-authorization.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ export async function deleteAuthorization(
3030
| DeleteAuthorizationOAuthAppOptions
3131
| DeleteAuthorizationGitHubAppOptions,
3232
): Promise<any> {
33-
const request =
34-
options.request ||
35-
/* istanbul ignore next: we always pass a custom request in tests */
36-
defaultRequest;
33+
/* v8 ignore start: we always pass a custom request in tests */
34+
const request = options.request || defaultRequest;
35+
/* v8 ignore stop */
3736

3837
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
3938
return request(

src/delete-token.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ export async function deleteToken(
2929
export async function deleteToken(
3030
options: DeleteTokenOAuthAppOptions | DeleteTokenGitHubAppOptions,
3131
): Promise<any> {
32-
const request =
33-
options.request ||
34-
/* istanbul ignore next: we always pass a custom request in tests */
35-
defaultRequest;
32+
/* v8 ignore start: we always pass a custom request in tests */
33+
const request = options.request || defaultRequest;
34+
/* v8 ignore stop */
3635

3736
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
3837
return request(

src/exchange-device-code.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,9 @@ export async function exchangeDeviceCode(
118118
| ExchangeDeviceCodeOAuthAppOptionsWithoutClientSecret
119119
| ExchangeDeviceCodeGitHubAppOptionsWithoutClientSecret,
120120
): Promise<any> {
121-
const request =
122-
options.request ||
123-
/* istanbul ignore next: we always pass a custom request in tests */
124-
defaultRequest;
121+
/* v8 ignore start: we always pass a custom request in tests */
122+
const request = options.request || defaultRequest;
123+
/* v8 ignore stop */
125124

126125
const response = await oauthRequest(
127126
request,

src/exchange-web-flow-code.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ export async function exchangeWebFlowCode(
6262
| ExchangeWebFlowCodeOAuthAppOptions
6363
| ExchangeWebFlowCodeGitHubAppOptions,
6464
): Promise<any> {
65-
const request =
66-
options.request ||
67-
/* istanbul ignore next: we always pass a custom request in tests */
68-
defaultRequest;
65+
/* v8 ignore start: we always pass a custom request in tests */
66+
const request = options.request || defaultRequest;
67+
/* v8 ignore stop */
6968

7069
const response = await oauthRequest(
7170
request,

src/refresh-token.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ export type RefreshTokenResponse =
2323
export async function refreshToken(
2424
options: RefreshTokenOptions,
2525
): Promise<RefreshTokenResponse> {
26-
const request =
27-
options.request ||
28-
/* istanbul ignore next: we always pass a custom request in tests */
29-
defaultRequest;
26+
/* v8 ignore start: we always pass a custom request in tests */
27+
const request = options.request || defaultRequest;
28+
/* v8 ignore stop */
3029

3130
const response = await oauthRequest(
3231
request,

src/reset-token.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ export async function resetToken(
4343
export async function resetToken(
4444
options: ResetTokenOAuthAppOptions | ResetTokenGitHubAppOptions,
4545
): Promise<any> {
46-
const request =
47-
options.request ||
48-
/* istanbul ignore next: we always pass a custom request in tests */
49-
defaultRequest;
46+
/* v8 ignore start: we always pass a custom request in tests */
47+
const request = options.request || defaultRequest;
48+
/* v8 ignore stop */
5049

5150
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
5251
const response = await request(

0 commit comments

Comments
 (0)