Skip to content

Commit

Permalink
feat: adds support for Node 20 (#74)
Browse files Browse the repository at this point in the history
OKTA-668902 feat: adds node 20 support
  • Loading branch information
jaredperreault-okta authored Nov 20, 2023
1 parent 074880f commit 834bc69
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 253 deletions.
13 changes: 12 additions & 1 deletion .bacon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,25 @@ test_suites:
timeout: '10'
script_name: unit
criteria: MERGE
queue_name: small
# a different container type is required to run node20
queue_name: ci-queue-productionJenga-AL2023
- name: e2e
script_path: /root/okta/okta-oidc-middleware/scripts
sort_order: '3'
timeout: '10'
script_name: e2e
criteria: MERGE
queue_name: small
- name: e2e-20
script_path: /root/okta/okta-oidc-middleware/scripts
sort_order: '3'
timeout: '10'
script_name: e2e
criteria: MERGE
# a different container type is required to run node20
queue_name: ci-queue-productionJenga-AL2023
script_env:
NODE_VER: '20.5.0'
- name: publish
script_path: /root/okta/okta-oidc-middleware/scripts
sort_order: '4'
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 5.2.0
-[#74](https://github.com/okta/okta-oidc-middleware/pull/74) feat: adds Node 20 support

# 5.1.0

-[#64](https://github.com/okta/okta-oidc-middleware/pull/64) Added type declarations
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"kill:port": "kill -s TERM $(lsof -t -i:8080 -sTCP:LISTEN) || true"
},
"engines": {
"node": "^12.19.0 || ^14.15.0 || ^16.13.0 || ^18.14.0"
"node": "^12.19.0 || ^14.15.0 || ^16.13.0 || ^18.14.0 || ^20.5.0"
},
"license": "Apache-2.0",
"dependencies": {
Expand All @@ -50,7 +50,7 @@
"lodash": "^4.17.21",
"negotiator": "^0.6.1",
"node-fetch": "^2.6.7",
"openid-client": "^5.1.9",
"openid-client": "^5.6.1",
"passport": "^0.6.0",
"uuid": "^8.3.2"
},
Expand Down
4 changes: 2 additions & 2 deletions scripts/e2e.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -x
#!/bin/bash

source ${OKTA_HOME}/${REPO}/scripts/setup.sh
source ${OKTA_HOME}/${REPO}/scripts/setup.sh "${NODE_VER:-v16.16.0}"

setup_service java 1.8.222
setup_service google-chrome-stable 89.0.4389.72-1
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -xe
#!/bin/bash

source ${OKTA_HOME}/${REPO}/scripts/setup.sh

Expand Down
28 changes: 20 additions & 8 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
#!/bin/bash -xe

# Use the cacert bundled with centos as okta root CA is self-signed and cause issues downloading from yarn
setup_service yarn 1.21.1 /etc/pki/tls/certs/ca-bundle.crt

# Add yarn to the $PATH so npm cli commands do not fail
export PATH="${PATH}:$(yarn global bin)"
#!/bin/bash

# Install required node version
export NVM_DIR="/root/.nvm"
setup_service node v16.16.0
setup_service node "${1:-v16.16.0}"

# determine the linux distro
distro=$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release | tr -d '"')
echo $distro

# yarn installation is different, depending on distro
if [ "$distro" = "centos" ]; then
# Use the cacert bundled with centos as okta root CA is self-signed and cause issues downloading from yarn
setup_service yarn 1.21.1 /etc/pki/tls/certs/ca-bundle.crt
# Add yarn to the $PATH so npm cli commands do not fail
export PATH="${PATH}:$(yarn global bin)"
elif [ "$distro" = "amzn" ]; then
npm install -g yarn
export PATH="$PATH:$(npm config get prefix)/bin"
else
echo "Unknown OS environment, exiting..."
exit ${FAILED_SETUP}
fi

cd ${OKTA_HOME}/${REPO}

Expand Down
44 changes: 42 additions & 2 deletions scripts/unit.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,55 @@
#!/bin/bash -x
#!/bin/bash

source ${OKTA_HOME}/${REPO}/scripts/setup.sh

export TEST_SUITE_TYPE="junit"
export TEST_RESULT_FILE_DIR="${REPO}/reports/unit"

# Run unit tests on multiple node versions

create_log_group "Node 14"
nvm install --silent 14
echo "Testing with Node 14"
echo $(node --version)
# Run jest with "ci" flag
if ! yarn test:unit --ci; then
echo "unit node 14 failed! Exiting..."
exit ${TEST_FAILURE}
fi
finish_log_group $?

create_log_group "Node 16"
nvm install --silent 16
echo "Testing with Node 16"
echo $(node --version)
# Run jest with "ci" flag
if ! yarn test:unit --ci; then
echo "unit node 16 failed! Exiting..."
exit ${TEST_FAILURE}
fi
finish_log_group $?

create_log_group "Node 18"
nvm install --silent 18
echo "Testing with Node 18"
echo $(node --version)
# Run jest with "ci" flag
if ! yarn test:unit --ci; then
echo "unit node 18 failed! Exiting..."
exit ${TEST_FAILURE}
fi
finish_log_group $?

create_log_group "Node 20"
nvm install --silent 20
echo "Testing with Node 20"
echo $(node --version)
# Run jest with "ci" flag
if ! yarn test:unit --ci; then
echo "unit failed! Exiting..."
echo "unit node 20 failed! Exiting..."
exit ${TEST_FAILURE}
fi
finish_log_group $?

echo ${TEST_SUITE_TYPE} > ${TEST_SUITE_TYPE_FILE}
echo ${TEST_RESULT_FILE_DIR} > ${TEST_RESULT_FILE_DIR_FILE}
Expand Down
Loading

0 comments on commit 834bc69

Please sign in to comment.