Skip to content

Commit 5b5f607

Browse files
authored
chore: bump Node.js to 20.12.0 MONGOSH-1750 MONGOSH-1691 (#1915)
1 parent dd71261 commit 5b5f607

9 files changed

+612
-156198
lines changed

.evergreen.yml

+524-524
Large diffs are not rendered by default.

.evergreen/install-node.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,20 @@ else
4545
# needs to be built from source
4646
if [[ "${DISTRO_ID}" =~ ^(amazon2-|rhel7|ubuntu18|suse12) ]] && [[ "$NODE_JS_VERSION" =~ ^20 ]];
4747
then
48-
bash "$BASEDIR/install-node-source.sh"
48+
NODE_JS_SOURCE_VERSION="$NODE_JS_VERSION"
49+
if echo $NODE_JS_VERSION | grep -q ^20 ; then
50+
# Node.js 20.11.1 is the last 20.x that builds out of the box on RHEL7
51+
# https://github.com/nodejs/node/issues/52223
52+
NODE_JS_SOURCE_VERSION=20.11.1
53+
fi
54+
env NODE_JS_VERSION="$NODE_JS_SOURCE_VERSION" bash "$BASEDIR/install-node-source.sh"
55+
nvm use $NODE_JS_SOURCE_VERSION
4956
else
5057
echo nvm install --no-progress $NODE_JS_VERSION && nvm alias default $NODE_JS_VERSION
5158
nvm install --no-progress $NODE_JS_VERSION
5259
nvm alias default $NODE_JS_VERSION
60+
nvm use $NODE_JS_VERSION
5361
fi
54-
nvm use $NODE_JS_VERSION
5562
set -x
5663

5764
if env PATH="/opt/chefdk/gitbin:$PATH" git --version | grep -q 'git version 1.'; then

.evergreen/node-20-latest.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"version": "20.11.1",
2+
"version": "20.12.0",
33
"major": 20,
4-
"minor": 11,
5-
"patch": 1,
4+
"minor": 12,
5+
"patch": 0,
66
"tag": "",
77
"codename": "iron",
88
"versionName": "v20",
99
"start": "2023-04-18T00:00:00.000Z",
1010
"lts": "2023-10-24T00:00:00.000Z",
1111
"maintenance": "2024-10-22T00:00:00.000Z",
1212
"end": "2026-04-30T00:00:00.000Z",
13-
"releaseDate": "2024-02-13T00:00:00.000Z",
13+
"releaseDate": "2024-03-26T00:00:00.000Z",
1414
"isLts": true,
1515
"files": [
1616
"aix-ppc64",
@@ -36,10 +36,10 @@
3636
"win-x86-zip"
3737
],
3838
"dependencies": {
39-
"npm": "10.2.4",
39+
"npm": "10.5.0",
4040
"v8": "11.3.244.8",
4141
"uv": "1.46.0",
42-
"zlib": "1.2.13.1-motley",
42+
"zlib": "1.3.0.1-motley",
4343
"openssl": "3.0.13+quic"
4444
}
4545
}

.evergreen/setup-env.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ if [ "$OS" != "Windows_NT" ]; then
1313
echo "Setting NVM environment home: $NVM_DIR"
1414
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
1515
set +x # nvm is very verbose
16-
echo nvm use $NODE_JS_VERSION
17-
nvm use $NODE_JS_VERSION
16+
echo nvm use $NODE_JS_VERSION || nvm use 20.11.1
17+
nvm use $NODE_JS_VERSION || nvm use 20.11.1 # see install-node.sh
1818
set -x
1919
export PATH="$NVM_BIN:$PATH"
2020

packages/cli-repl/src/mongosh-repl.spec.ts

+33-8
Original file line numberDiff line numberDiff line change
@@ -840,24 +840,27 @@ describe('MongoshNodeRepl', function () {
840840
});
841841

842842
context('thrown non-Errors', function () {
843+
before(function () {
844+
if (+process.version.split('.')[0].slice(1) < 20) this.skip();
845+
});
846+
843847
it('allows `throw null`', async function () {
844848
output = '';
845849
input.write('throw null;\n');
846850
await waitEval(bus);
847-
// We do verify that both `Error` and `null` are syntax-highlighted here.
848-
expect(output).to.match(
849-
/\x1b\[\d+mError\x1b\[\d+m: \x1b\[\d+mnull\x1b\[\d+m/
850-
);
851+
// Neither `Error` nor `null` are syntax-highlighted here
852+
// because since Node.js 20.12.0+ the output stream needs
853+
// to look like a TTY (instead of only requiring terminal: true
854+
// on the REPL options object).
855+
expect(output).to.include('Error: null');
851856
});
852857

853858
it('allows `throw number`', async function () {
854859
output = '';
855860
input.write('throw 123;\n');
856861
await waitEval(bus);
857-
// We do verify that both `Error` and `123` are syntax-highlighted here.
858-
expect(output).to.match(
859-
/\x1b\[\d+mError\x1b\[\d+m: \x1b\[\d+m123\x1b\[\d+m/
860-
);
862+
// Similar to the test above, this is no longer syntax-highlighted.
863+
expect(output).to.include('Error: 123');
861864
});
862865
});
863866
});
@@ -1036,6 +1039,28 @@ describe('MongoshNodeRepl', function () {
10361039
expect(output).to.include('ReferenceError');
10371040
});
10381041
});
1042+
1043+
context('thrown non-Errors with syntax highlighting', function () {
1044+
it('allows `throw null`', async function () {
1045+
output = '';
1046+
input.write('throw null;\n');
1047+
await waitEval(bus);
1048+
// We do verify that both `Error` and `null` are syntax-highlighted here.
1049+
expect(output).to.match(
1050+
/\x1b\[\d+mError\x1b\[\d+m: \x1b\[\d+mnull\x1b\[\d+m/
1051+
);
1052+
});
1053+
1054+
it('allows `throw number`', async function () {
1055+
output = '';
1056+
input.write('throw 123;\n');
1057+
await waitEval(bus);
1058+
// We do verify that both `Error` and `123` are syntax-highlighted here.
1059+
expect(output).to.match(
1060+
/\x1b\[\d+mError\x1b\[\d+m: \x1b\[\d+m123\x1b\[\d+m/
1061+
);
1062+
});
1063+
});
10391064
});
10401065

10411066
context('with somewhat unreachable history file', function () {

0 commit comments

Comments
 (0)