Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to node v20 #3069

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.19.0
20.11.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.4
FROM node:18.19.0-alpine3.18 AS base
FROM node:20.11.0-alpine3.19 AS base
koladilip marked this conversation as resolved.
Show resolved Hide resolved
ENV HUSKY 0

RUN apk update
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-ut-func
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV HUSKY 0
RUN apt-get update \
&& apt-get install -y curl make g++ \
&& apt-get install -y cpio \
&& curl -sL https://deb.nodesource.com/setup_18.x | bash \
&& curl -sL https://deb.nodesource.com/setup_20.x | bash \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/apt/lists.d/* \
Expand Down
2,427 changes: 1,348 additions & 1,079 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
"verify": "eslint . || exit 1; npm run test:js || exit 1",
"test:testRouter": "jest testRouter --detectOpenHandles --coverage --notify --watchAll=false",
"test:benchmark": "node benchmark/index.js",
"test": "jest -c jest.config.js --detectOpenHandles",
"test": "NODE_OPTIONS='--no-node-snapshot' jest -c jest.config.js --detectOpenHandles",
"test:ci": "npm run test -- --coverage --expand --maxWorkers=50%",
"test:js": "jest -c jest.default.config.js --detectOpenHandles",
"test:js": "NODE_OPTIONS='--no-node-snapshot' jest -c jest.default.config.js --detectOpenHandles",
"test:js:silent": "npm run test:js -- --silent",
"test:js:ci": "npm run test:js -- --coverage --expand --maxWorkers=50%",
"test:ts": "jest -c jest.config.typescript.js --detectOpenHandles",
"test:ts": "NODE_OPTIONS='--no-node-snapshot' jest -c jest.config.typescript.js --detectOpenHandles",
"test:ts:component:generateNwMocks": "npm run test:ts -- component --generate=true",
"test:ts:silent": "npm run test:ts -- --silent",
"test:ts:ci": "npm run test:ts -- --coverage --expand --maxWorkers=50%",
"test:ut:integration": "jest \"user_transformation.integration.test.js\" --detectOpenHandles --notify",
"test:ut:integration": "NODE_OPTIONS='--no-node-snapshot' jest \"user_transformation.integration.test.js\" --detectOpenHandles --notify",
"test:ut:integration:silent": "npm run test:ut:integration -- --silent",
"test:ut:integration:ci": "npm run test:ut:integration -- --expand --maxWorkers=50%",
"pre-commit": "npm run test:ts:silent && npm run test:js:silent && npx lint-staged",
Expand Down Expand Up @@ -83,7 +83,7 @@
"ioredis": "^5.3.2",
"is": "^3.3.0",
"is-ip": "^3.1.0",
"isolated-vm": "4.5.0",
"isolated-vm": "4.7.2",
"js-sha1": "^0.6.0",
"json-diff": "^1.0.3",
"json-size": "^1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
transformerVersionId,
error: 'true',
});
cb(null, `unable to resolve IP address for ${hostname}`, RECORD_TYPE_A);
cb(new Error(`unable to resolve IP address for ${hostname}`), null, RECORD_TYPE_A);
return;
}
stats.timing('fetch_dns_resolve_time', resolveStartTime, { transformerVersionId });

if (ips.length === 0) {
cb(null, `resolved empty list of IP address for ${hostname}`, RECORD_TYPE_A);
cb(new Error(`resolved empty list of IP address for ${hostname}`), null, RECORD_TYPE_A);

Check warning on line 35 in src/util/utils.js

View check run for this annotation

Codecov / codecov/patch

src/util/utils.js#L35

Added line #L35 was not covered by tests
return;
}

// eslint-disable-next-line no-restricted-syntax
for (const ip of ips) {
if (ip.startsWith(LOCALHOST_OCTET)) {
cb(null, `cannot use ${ip} as IP address`, RECORD_TYPE_A);
cb(new Error(`cannot use ${ip} as IP address`), null, RECORD_TYPE_A);
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/__tests__/user_transformation_fetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe("User transformation fetch tests", () => {
}
`
};
const errMsg = "request to https://abc.xyz.com/dummyUrl failed, reason: Invalid IP address: unable to resolve IP address for abc.xyz.com";
const errMsg = "request to https://abc.xyz.com/dummyUrl failed, reason: unable to resolve IP address for abc.xyz.com";

mockResolver.mockRejectedValue('invalid host');
const output = await userTransformHandler(inputData, versionId, [], trRevCode, true);
Expand Down Expand Up @@ -305,7 +305,7 @@ describe("User transformation fetch tests", () => {
}
`
};
const errMsg = "request to https://abc.xyz.com/dummyUrl failed, reason: Invalid IP address: cannot use 127.0.0.1 as IP address";
const errMsg = "request to https://abc.xyz.com/dummyUrl failed, reason: cannot use 127.0.0.1 as IP address";

mockResolver.mockResolvedValue(['3.122.122.122', '127.0.0.1']);
const output = await userTransformHandler(inputData, versionId, [], trRevCode, true);
Expand Down
Loading