Skip to content

Conversation

@github-actions
Copy link
Contributor

Summary

Fixed CI test failure in pkg/cli/compile_dependabot_test.go caused by broken npm installation in the CI environment.

Problem

The hourly CI cleaner workflow (run #304) failed because the TestCompileDependabotIntegration test was failing. The test was checking if npm exists using exec.LookPath("npm"), but this only verifies that the npm binary is present - not that it's functional.

In the CI environment, npm was found at /usr/local/bin/npm but was broken with this error:

Error: Cannot find module '../lib/cli.js'
Require stack:
- /usr/local/bin/npm

This caused the test to run and then fail when trying to generate package-lock.json, instead of being properly skipped.

Solution

Enhanced the npm availability check to not only verify npm exists, but also test if it can actually execute by running npm --version. If npm is not functional, the test is now properly skipped with a clear message:

// Check if npm is available and functional
npmPath, err := exec.LookPath("npm")
if err != nil {
    t.Skip("Skipping test - npm not available")
}
// Test if npm actually works
cmd := exec.Command(npmPath, "--version")
if err := cmd.Run(); err != nil {
    t.Skipf("Skipping test - npm is not functional: %v", err)
}

Testing

  • ✅ All Go tests now pass (including the previously failing test which is now properly skipped)
  • ✅ Code formatting passes (go fmt)
  • ✅ Linting passes (golangci-lint)

CI Run Context

Changes

  • Modified pkg/cli/compile_dependabot_test.go to check npm functionality before running the test
  • No other files modified
  • No breaking changes

This fix ensures that the test behaves correctly in environments where npm may be present but not functional.

AI generated by Hourly CI Cleaner

The test was checking if npm exists but not if it's functional.
This caused the test to fail when npm exists but is broken.

Now the test checks if npm can actually execute before running,
properly skipping when npm is not functional.
@pelikhan pelikhan marked this pull request as ready for review December 23, 2025 14:27
@pelikhan pelikhan merged commit 02dd2ec into main Dec 23, 2025
4 checks passed
@pelikhan pelikhan deleted the ci-cleaner-fix-npm-test-3a3605e4a7f7dbf5 branch December 23, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant