diff --git a/buildspec/linuxTests.yml b/buildspec/linuxTests.yml index 49fe7c7d8ed..c1a8055aa43 100644 --- a/buildspec/linuxTests.yml +++ b/buildspec/linuxTests.yml @@ -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