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

chore: bump Node.js to 20.12.0 MONGOSH-1750 MONGOSH-1691 #1915

Merged
merged 6 commits into from Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,048 changes: 524 additions & 524 deletions .evergreen.yml

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions .evergreen/install-node.sh
Expand Up @@ -45,13 +45,20 @@ else
# needs to be built from source
if [[ "${DISTRO_ID}" =~ ^(amazon2-|rhel7|ubuntu18|suse12) ]] && [[ "$NODE_JS_VERSION" =~ ^20 ]];
then
bash "$BASEDIR/install-node-source.sh"
NODE_JS_SOURCE_VERSION="$NODE_JS_VERSION"
if echo $NODE_JS_VERSION | grep -q ^20 ; then
# Node.js 20.11.1 is the last 20.x that builds out of the box on RHEL7
# https://github.com/nodejs/node/issues/52223
NODE_JS_SOURCE_VERSION=20.11.1
fi
env NODE_JS_VERSION="$NODE_JS_SOURCE_VERSION" bash "$BASEDIR/install-node-source.sh"
nvm use $NODE_JS_SOURCE_VERSION
else
echo nvm install --no-progress $NODE_JS_VERSION && nvm alias default $NODE_JS_VERSION
nvm install --no-progress $NODE_JS_VERSION
nvm alias default $NODE_JS_VERSION
nvm use $NODE_JS_VERSION
fi
nvm use $NODE_JS_VERSION
set -x

if env PATH="/opt/chefdk/gitbin:$PATH" git --version | grep -q 'git version 1.'; then
Expand Down
12 changes: 6 additions & 6 deletions .evergreen/node-20-latest.json
@@ -1,16 +1,16 @@
{
"version": "20.11.1",
"version": "20.12.0",
"major": 20,
"minor": 11,
"patch": 1,
"minor": 12,
"patch": 0,
"tag": "",
"codename": "iron",
"versionName": "v20",
"start": "2023-04-18T00:00:00.000Z",
"lts": "2023-10-24T00:00:00.000Z",
"maintenance": "2024-10-22T00:00:00.000Z",
"end": "2026-04-30T00:00:00.000Z",
"releaseDate": "2024-02-13T00:00:00.000Z",
"releaseDate": "2024-03-26T00:00:00.000Z",
"isLts": true,
"files": [
"aix-ppc64",
Expand All @@ -36,10 +36,10 @@
"win-x86-zip"
],
"dependencies": {
"npm": "10.2.4",
"npm": "10.5.0",
"v8": "11.3.244.8",
"uv": "1.46.0",
"zlib": "1.2.13.1-motley",
"zlib": "1.3.0.1-motley",
"openssl": "3.0.13+quic"
}
}
4 changes: 2 additions & 2 deletions .evergreen/setup-env.sh
Expand Up @@ -13,8 +13,8 @@ if [ "$OS" != "Windows_NT" ]; then
echo "Setting NVM environment home: $NVM_DIR"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
set +x # nvm is very verbose
echo nvm use $NODE_JS_VERSION
nvm use $NODE_JS_VERSION
echo nvm use $NODE_JS_VERSION || nvm use 20.11.1
nvm use $NODE_JS_VERSION || nvm use 20.11.1 # see install-node.sh
set -x
export PATH="$NVM_BIN:$PATH"

Expand Down
41 changes: 33 additions & 8 deletions packages/cli-repl/src/mongosh-repl.spec.ts
Expand Up @@ -840,24 +840,27 @@ describe('MongoshNodeRepl', function () {
});

context('thrown non-Errors', function () {
before(function () {
if (+process.version.split('.')[0].slice(1) < 20) this.skip();
});

it('allows `throw null`', async function () {
output = '';
input.write('throw null;\n');
await waitEval(bus);
// We do verify that both `Error` and `null` are syntax-highlighted here.
expect(output).to.match(
/\x1b\[\d+mError\x1b\[\d+m: \x1b\[\d+mnull\x1b\[\d+m/
);
// Neither `Error` nor `null` are syntax-highlighted here
// because since Node.js 20.12.0+ the output stream needs
// to look like a TTY (instead of only requiring terminal: true
// on the REPL options object).
expect(output).to.include('Error: null');
});

it('allows `throw number`', async function () {
output = '';
input.write('throw 123;\n');
await waitEval(bus);
// We do verify that both `Error` and `123` are syntax-highlighted here.
expect(output).to.match(
/\x1b\[\d+mError\x1b\[\d+m: \x1b\[\d+m123\x1b\[\d+m/
);
// Similar to the test above, this is no longer syntax-highlighted.
expect(output).to.include('Error: 123');
});
});
});
Expand Down Expand Up @@ -1036,6 +1039,28 @@ describe('MongoshNodeRepl', function () {
expect(output).to.include('ReferenceError');
});
});

context('thrown non-Errors with syntax highlighting', function () {
it('allows `throw null`', async function () {
output = '';
input.write('throw null;\n');
await waitEval(bus);
// We do verify that both `Error` and `null` are syntax-highlighted here.
expect(output).to.match(
/\x1b\[\d+mError\x1b\[\d+m: \x1b\[\d+mnull\x1b\[\d+m/
);
});

it('allows `throw number`', async function () {
output = '';
input.write('throw 123;\n');
await waitEval(bus);
// We do verify that both `Error` and `123` are syntax-highlighted here.
expect(output).to.match(
/\x1b\[\d+mError\x1b\[\d+m: \x1b\[\d+m123\x1b\[\d+m/
);
});
});
});

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