Skip to content

Commit a640d5c

Browse files
authored
chore: node js 18 upgrd (#2519)
* chore: node js upgrd * fix: test case failure
1 parent fbe60c8 commit a640d5c

27 files changed

+1329
-1025
lines changed

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.21.1
1+
18.18.1

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:14.21-alpine3.16 as build
1+
FROM node:18-alpine3.18 as build
22

33
# adding python for node-gyp
44
RUN apk add g++ make python3

Dockerfile.prod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:14.21-alpine3.16 as build
1+
FROM node:18-alpine3.18 as build
22

33
# adding python for node-gyp
44
RUN apk add g++ make python3
@@ -28,7 +28,7 @@ RUN yarn run build:release
2828
# https://stackoverflow.com/questions/57108751/docker-build-failed-when-copying-in-multi-step-build
2929
RUN chown root:root -R /app
3030

31-
FROM node:14.21-alpine3.16
31+
FROM node:18-alpine3.18
3232

3333
# adding to solve vuln
3434
RUN apk add --update --upgrade busybox

package.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "GitHub integration for Atlassian Jira",
55
"repository": "https://github.com/atlassian/github-for-jira.git",
66
"engines": {
7-
"node": ">= 14.21 <15",
7+
"node": ">= 18.18.1",
88
"yarn": "^1.22.0"
99
},
1010
"main": "src/main",
@@ -28,7 +28,7 @@
2828
"lint:ts": "eslint . --ext .ts,.tsx",
2929
"lint:yaml": "yamllint github-for-jira.sd.yml",
3030
"pretest": "NODE_ENV=test run-p clean setup db:test",
31-
"test": "yarn spa:test && jest --runInBand --forceExit --coverage",
31+
"test": "yarn spa:test && jest --forceExit --coverage --runInBand --logHeapUsage --workerIdleMemoryLimit='2GB'",
3232
"test:watch": "jest --runInBand --watchAll --coverage=false",
3333
"db": "run-s db:create db:migrate",
3434
"db:create": "run-p db:create:dev db:create:test",
@@ -95,6 +95,7 @@
9595
"helmet": "^3.21.2",
9696
"hot-shots": "^8.3.2",
9797
"http-proxy": "^1.18.1",
98+
"http-proxy-agent": "^7.0.0",
9899
"https-proxy-agent": "5.0.0",
99100
"ioredis": "^4.16.3",
100101
"is-base64": "^1.1.0",
@@ -157,13 +158,14 @@
157158
"eslint-import-resolver-typescript": "^2.5.0",
158159
"eslint-plugin-import": "^2.25.4",
159160
"eslint-plugin-jest": "^27.4.0",
160-
"eslint-plugin-jsdoc": "^37.9.3",
161+
"eslint-plugin-jsdoc": "^46.8.2",
161162
"eslint-plugin-no-only-tests": "^2.6.0",
162163
"eslint-plugin-node": "^11.1.0",
163164
"eslint-plugin-promise": "^6.0.0",
164165
"husky": "^6.0.0",
165-
"jest": "^27.5.1",
166-
"jest-diff": "^27.5.1",
166+
"jest": "^29.7.0",
167+
"jest-diff": "^29.7",
168+
"jest-environment-jsdom": "^29.7.0",
167169
"jest-when": "^3.5.1",
168170
"keygrip": "^1.0.2",
169171
"nock": "^13.2.4",
@@ -175,7 +177,7 @@
175177
"smee-client": "^1.2.2",
176178
"sqlite3": "^5.1.5",
177179
"supertest": "^6.2.2",
178-
"ts-jest": "~27.1.3",
180+
"ts-jest": "^29.1.1",
179181
"ts-node": "^10.5.0",
180182
"ts-node-dev": "^2.0.0",
181183
"yaml-lint": "^1.2.4"
@@ -184,7 +186,7 @@
184186
"@atlassian/sqs-queue-dlq-service": "^2.1.1"
185187
},
186188
"volta": {
187-
"node": "14.21.1",
189+
"node": "18.18.1",
188190
"yarn": "1.22.18"
189191
}
190192
}

spa/jest.config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"^.+\\.tsx?$": "ts-jest"
55
},
66
"setupFilesAfterEnv": [
7-
"@testing-library/jest-dom/extend-expect"
7+
"./setup.ts"
88
]
99
}

spa/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"simplebar-react": "^3.2.4"
4949
},
5050
"devDependencies": {
51-
"@testing-library/jest-dom": "^5.16.5",
51+
"@testing-library/jest-dom": "^6.1.4",
5252
"@testing-library/react": "^14.0.0",
5353
"@testing-library/user-event": "^14.4.3",
5454
"@types/jest": "^29.5.2",

spa/setup.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "@testing-library/jest-dom";

spa/yarn.lock

+10-18
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
resolved "https://packages.atlassian.com/api/npm/npm-remote/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
88
integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==
99

10-
"@adobe/css-tools@^4.0.1":
11-
version "4.2.0"
12-
resolved "https://packages.atlassian.com/api/npm/npm-remote/@adobe/css-tools/-/css-tools-4.2.0.tgz#e1a84fca468f4b337816fcb7f0964beb620ba855"
13-
integrity sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==
10+
"@adobe/css-tools@^4.3.1":
11+
version "4.3.1"
12+
resolved "https://packages.atlassian.com/api/npm/npm-remote/@adobe/css-tools/-/css-tools-4.3.1.tgz#abfccb8ca78075a2b6187345c26243c1a0842f28"
13+
integrity sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg==
1414

1515
"@alloc/quick-lru@^5.2.0":
1616
version "5.2.0"
@@ -2878,14 +2878,13 @@
28782878
lz-string "^1.5.0"
28792879
pretty-format "^27.0.2"
28802880

2881-
"@testing-library/jest-dom@^5.16.5":
2882-
version "5.16.5"
2883-
resolved "https://packages.atlassian.com/api/npm/npm-remote/@testing-library/jest-dom/-/jest-dom-5.16.5.tgz#3912846af19a29b2dbf32a6ae9c31ef52580074e"
2884-
integrity sha512-N5ixQ2qKpi5OLYfwQmUb/5mSV9LneAcaUfp32pn4yCnpb8r/Yz0pXFPck21dIicKmi+ta5WRAknkZCfA8refMA==
2881+
"@testing-library/jest-dom@^6.1.4":
2882+
version "6.1.4"
2883+
resolved "https://packages.atlassian.com/api/npm/npm-remote/@testing-library/jest-dom/-/jest-dom-6.1.4.tgz#cf0835c33bc5ef00befb9e672b1e3e6a710e30e3"
2884+
integrity sha512-wpoYrCYwSZ5/AxcrjLxJmCU6I5QAJXslEeSiMQqaWmP2Kzpd1LvF/qxmAIW2qposULGWq2gw30GgVNFLSc2Jnw==
28852885
dependencies:
2886-
"@adobe/css-tools" "^4.0.1"
2886+
"@adobe/css-tools" "^4.3.1"
28872887
"@babel/runtime" "^7.9.2"
2888-
"@types/testing-library__jest-dom" "^5.9.1"
28892888
aria-query "^5.0.0"
28902889
chalk "^3.0.0"
28912890
css.escape "^1.5.1"
@@ -3092,7 +3091,7 @@
30923091
dependencies:
30933092
"@types/istanbul-lib-report" "*"
30943093

3095-
"@types/jest@*", "@types/jest@^29.5.2":
3094+
"@types/jest@^29.5.2":
30963095
version "29.5.2"
30973096
resolved "https://packages.atlassian.com/api/npm/npm-remote/@types/jest/-/jest-29.5.2.tgz#86b4afc86e3a8f3005b297ed8a72494f89e6395b"
30983097
integrity sha512-mSoZVJF5YzGVCk+FsDxzDuH7s+SCkzrgKZzf0Z0T2WudhBUPoF6ktoTPC4R0ZoCPCV5xUvuU6ias5NvxcBcMMg==
@@ -3284,13 +3283,6 @@
32843283
resolved "https://packages.atlassian.com/api/npm/npm-remote/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"
32853284
integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==
32863285

3287-
"@types/testing-library__jest-dom@^5.9.1":
3288-
version "5.14.6"
3289-
resolved "https://packages.atlassian.com/api/npm/npm-remote/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.6.tgz#4887f6e1af11215428ab02777873bcede98a53b0"
3290-
integrity sha512-FkHXCb+ikSoUP4Y4rOslzTdX5sqYwMxfefKh1GmZ8ce1GOkEHntSp6b5cGadmNfp5e4BMEWOMx+WSKd5/MqlDA==
3291-
dependencies:
3292-
"@types/jest" "*"
3293-
32943286
"@types/tough-cookie@*":
32953287
version "4.0.2"
32963288
resolved "https://packages.atlassian.com/api/npm/npm-remote/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397"

src/config/feature-flags.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import LaunchDarkly, { LDClient } from "launchdarkly-node-server-sdk";
2-
import { mocked } from "ts-jest/utils";
2+
import { mocked } from "jest-mock";
33

44
jest.mock("launchdarkly-node-server-sdk");
55

src/github/client/token-cache.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { AuthToken, TEN_MINUTES } from "./auth-token";
33
import { AppTokenHolder } from "./app-token-holder";
44
import { getInstallationId } from "./installation-id";
55
import { keyLocator } from "./key-locator";
6-
import { mocked } from "ts-jest/utils";
6+
import { mocked } from "jest-mock";
77
import { Subscription } from "~/src/models/subscription";
88
import { envVars } from "config/env";
99
import fs from "fs";

src/middleware/github-webhook-middleware.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mocked } from "ts-jest/utils";
1+
import { mocked } from "jest-mock";
22
import { Installation } from "models/installation";
33
import { Subscription } from "models/subscription";
44
import { GithubWebhookMiddleware } from "./github-webhook-middleware";

src/models/reposyncstate.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import { Subscription } from "./subscription";
33
import { RepoSyncState } from "./reposyncstate";
4-
import { mocked } from "ts-jest/utils";
4+
import { mocked } from "jest-mock";
55
import { booleanFlag } from "config/feature-flags";
66

77
jest.mock("config/feature-flags");

src/routes/api/api-replay-failed-entities-from-data-depot.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Installation } from "~/src/models/installation";
88
import { createHashWithSharedSecret } from "~/src/util/encryption";
99
import { RepoSyncState } from "~/src/models/reposyncstate";
1010
import { booleanFlag } from "../../config/feature-flags";
11-
import { mocked } from "ts-jest/utils";
11+
import { mocked } from "jest-mock";
1212

1313

1414
jest.mock("config/feature-flags");

src/routes/api/api-resync-failed-tasks.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import express, { Application, NextFunction, Request, Response } from "express";
2-
import { mocked } from "ts-jest/utils";
2+
import { mocked } from "jest-mock";
33
import { booleanFlag } from "~/src/config/feature-flags";
44
import { getLogger } from "~/src/config/logger";
55
import { ApiRouter } from "./api-router";

src/routes/github/branch/github-branch-get.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import { getLogger } from "config/logger";
33
import { GithubBranchGet } from "routes/github/branch/github-branch-get";
4-
import { mocked } from "ts-jest/utils";
4+
import { mocked } from "jest-mock";
55
import { Subscription } from "models/subscription";
66

77
jest.mock("models/subscription");

src/routes/github/create-branch/github-branches-get.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { getLogger } from "config/logger";
33
import { GithubBranchesGet } from "~/src/routes/github/create-branch/github-branches-get";
44
import { Subscription } from "models/subscription";
5-
import { mocked } from "ts-jest/utils";
5+
import { mocked } from "jest-mock";
66

77
jest.mock("models/subscription");
88

src/routes/github/create-branch/github-create-branch-post.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Installation } from "models/installation";
33
import { Subscription } from "models/subscription";
44
import { GithubCreateBranchPost } from "./github-create-branch-post";
55
import { getLogger } from "config/logger";
6-
import { mocked } from "ts-jest/utils";
6+
import { mocked } from "jest-mock";
77

88
jest.mock("models/subscription");
99

src/routes/jira/events/jira-events-install-post.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import { JiraEventsInstallPost } from "./jira-events-install-post";
3-
import { mocked } from "ts-jest/utils";
3+
import { mocked } from "jest-mock";
44
import { Installation } from "models/installation";
55

66
jest.mock("models/installation");

src/routes/jira/jira-delete.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import { Installation } from "models/installation";
33
import { Subscription } from "models/subscription";
4-
import { mocked } from "ts-jest/utils";
4+
import { mocked } from "jest-mock";
55
import { JiraDelete } from "./jira-delete";
66
import { getLogger } from "config/logger";
77
import { when } from "jest-when";

src/transforms/transform-code-scanning-alert.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,12 @@ describe("code_scanning_alert transform", () => {
320320
jiraHost
321321
);
322322
expect(result?.vulnerabilities[0].identifiers).toMatchInlineSnapshot(`
323-
Array [
324-
Object {
323+
[
324+
{
325325
"displayName": "CWE-79",
326326
"url": "https://cwe.mitre.org/cgi-bin/jumpmenu.cgi?id=79",
327327
},
328-
Object {
328+
{
329329
"displayName": "CWE-116",
330330
"url": "https://cwe.mitre.org/cgi-bin/jumpmenu.cgi?id=116",
331331
},

src/util/jira-utils.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
isGitHubCloudApp,
77
jiraIssueKeyParser
88
} from "./jira-utils";
9-
import { mocked } from "ts-jest/utils";
9+
import { mocked } from "jest-mock";
1010
import { GitHubServerApp } from "models/github-server-app";
1111

1212
jest.mock("models/github-server-app");

test/snapshots/jira/client/jira-client.test.ts.snap

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`Test getting a jira client Installation exists 1`] = `
4-
Object {
4+
{
55
"baseURL": "https://test-atlassian-instance.atlassian.net",
6-
"deployment": Object {
6+
"deployment": {
77
"submit": [Function],
88
},
9-
"devinfo": Object {
10-
"branch": Object {
9+
"devinfo": {
10+
"branch": {
1111
"delete": [Function],
1212
},
13-
"installation": Object {
13+
"installation": {
1414
"delete": [Function],
1515
},
16-
"pullRequest": Object {
16+
"pullRequest": {
1717
"delete": [Function],
1818
},
19-
"repository": Object {
19+
"repository": {
2020
"delete": [Function],
2121
"update": [Function],
2222
},
2323
},
24-
"issues": Object {
25-
"comments": Object {
24+
"issues": {
25+
"comments": {
2626
"addForIssue": [Function],
2727
"deleteForIssue": [Function],
2828
"list": [Function],
@@ -31,21 +31,21 @@ Object {
3131
"get": [Function],
3232
"getAll": [Function],
3333
"parse": [Function],
34-
"transitions": Object {
34+
"transitions": {
3535
"getForIssue": [Function],
3636
"updateForIssue": [Function],
3737
},
38-
"worklogs": Object {
38+
"worklogs": {
3939
"addForIssue": [Function],
4040
},
4141
},
42-
"remoteLink": Object {
42+
"remoteLink": {
4343
"submit": [Function],
4444
},
45-
"security": Object {
45+
"security": {
4646
"submitVulnerabilities": [Function],
4747
},
48-
"workflow": Object {
48+
"workflow": {
4949
"submit": [Function],
5050
},
5151
}

0 commit comments

Comments
 (0)