Skip to content

Commit

Permalink
ci: report "npm WARN deprecated"
Browse files Browse the repository at this point in the history
Problem:
Deprecated dependencies may not be noticed for a long time.

    npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
    npm WARN deprecated winston@3.7.1: Please use version 3.6.0 or >3.7.1 when available due to winstonjs/winston#2103

Solution:
Collect these warnings when running CI.
TODO: fail if new warnings are found.
  • Loading branch information
justinmk3 committed Jan 4, 2024
1 parent 1e48a31 commit 02e7fcc
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions buildspec/linuxTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,32 @@ phases:
{
set -e
set -o pipefail
_PROMISE_REJ_MSG='rejected promise not handled'
# Capture messages that we may want to fail (or report) later.
_ERROR_PAT1='rejected promise not handled'
_ERROR_PAT2='npm WARN deprecated'
_ERROR_ANY="(${_ERROR_PAT1})|(${_ERROR_PAT2})"
mkfifo testout
(cat testout &)
xvfb-run npm test --silent | tee testout \
| grep -v 'undefined..reading..range' \
| grep -v CODEWHISPERER_INLINE_UPDATE_LOCK_KEY \
| { >testout-rej grep --line-buffered "$_PROMISE_REJ_MSG" || true; }
if [ -s testout-rej ] ; then
echo ''
cat testout-rej | sort
| { >testout-err grep --line-buffered -E "$_ERROR_ANY" || true; }
echo ''
if grep "$_ERROR_PAT1" testout-err | sort ; then
printf '\n\nERROR: Found %s "%s" in test output (see above).\n%s\n\n' \
"$(cat testout-rej | wc -l | tr -d ' ')" \
"$_PROMISE_REJ_MSG" \
"$(grep "${_ERROR_PAT1}" testout-err | wc -l | tr -d ' ')" \
"$_ERROR_PAT1" \
' This typically indicates a bug. Read https://developer.mozilla.org/docs/Web/JavaScript/Guide/Using_promises#error_handling'
# TODO: fail the CI job
# exit 1;
fi
echo ''
if grep "$_ERROR_PAT2" testout-err | sort ; then
printf '\n\nERROR: Found %s "%s" in test output (see above).\n%s\n\n' \
"$(grep "${_ERROR_PAT2}" testout-err | wc -l | tr -d ' ')" \
"$_ERROR_PAT2" \
' Deprecated dependencies must be updated.'
# TODO: fail the CI job
# exit 1;
fi
}
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g') # Encode `#` in the URL because otherwise the url is clipped in the Codecov.io site
Expand Down

0 comments on commit 02e7fcc

Please sign in to comment.