Skip to content

Commit 8d8d190

Browse files
fix(lighthouse): allow warning-level npm audit findings during setup
Treat npm_install_secure exit code 1 as warning-level for Lighthouse test tooling when required packages are installed (lighthouse, puppeteer). Keep hard-fail behavior for critical/install failures.
1 parent f9006ab commit 8d8d190

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

openshift/scripts/utils/lighthouse.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,22 @@ setup_lighthouse_environment() {
223223
source "./openshift/scripts/utils/npm.sh"
224224

225225
# Install dependencies with security validation (npm_install_secure will cd into the directory)
226-
if npm_install_secure "$config_dir" "auto" "true"; then
226+
local npm_install_exit=0
227+
npm_install_secure "$config_dir" "auto" "true"
228+
npm_install_exit=$?
229+
230+
if [ "$npm_install_exit" -eq 0 ]; then
227231
log_info "Lighthouse dependencies installed and validated"
232+
elif [ "$npm_install_exit" -eq 1 ]; then
233+
# Exit code 1 can be warning-level NPM findings (high/moderate) in post-install scan.
234+
# For Lighthouse (test tooling), we allow warning-level findings if dependencies are present.
235+
if cd "$config_dir" && npm list lighthouse puppeteer --depth=0 >/dev/null 2>&1; then
236+
log_warn "Lighthouse dependency installation completed with non-critical security warnings"
237+
log_warn "Proceeding in warning mode; review npm audit/Dependabot updates"
238+
else
239+
log_error "Failed to install required Lighthouse dependencies"
240+
return 1
241+
fi
228242
else
229243
log_error "Failed to install or validate Lighthouse dependencies"
230244
return 1

0 commit comments

Comments
 (0)