Skip to content

Daily Test Coverage Improver - Fix coverage steps configuration for CI environment#252

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
test/fix-coverage-steps-dns-issue-ca32f3b63899a728
Draft

Daily Test Coverage Improver - Fix coverage steps configuration for CI environment#252
github-actions[bot] wants to merge 1 commit intomainfrom
test/fix-coverage-steps-dns-issue-ca32f3b63899a728

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Mar 1, 2026

Problem

The coverage steps configuration in .github/actions/daily-test-improver/coverage-steps/action.yml is failing in CI with two critical issues:

  1. Node.js version mismatch: Vite 7.x requires Node.js 20.19+ or 22.12+, but the action was configured for Node.js 18
  2. DNS resolution failure: Tests fail with Error: getaddrinfo EAI_AGAIN localhost due to missing /etc/hosts file in some CI environments

From coverage-steps.log:

You are using Node.js 18.20.8. Vite requires Node.js version 20.19+ or 22.12+
⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯
Error: getaddrinfo EAI_AGAIN localhost

Solution

This PR updates the coverage steps action to:

1. Upgrade Node.js to v20

  • Changed node-version: '18' to node-version: '20' to meet Vite requirements
  • Eliminates deprecation warnings during build

2. Add hosts file setup step

  • Creates /etc/hosts if missing in CI environment
  • Maps 127.0.0.1 and ::1 to localhost
  • Prevents DNS resolution errors during test execution

3. Switch to happy-dom environment

  • Changed Vitest environment from jsdom to happy-dom
  • happy-dom is lighter weight and more compatible with containerized CI environments
  • Handles DOM testing without requiring full browser infrastructure
  • Added happy-dom to installed npm dependencies

Testing Needed

This PR should be tested in the actual GitHub Actions CI environment to verify:

  • /etc/hosts setup step completes successfully (may need sudo permissions)
  • JavaScript/TypeScript tests run without DNS errors
  • Coverage reports are generated in coverage/js/
  • Python tests continue to work as expected

Reproducibility

To test coverage generation after these changes:

# Install dependencies
npm install

# Run coverage
npm run test:coverage

# Check coverage report
ls -la coverage/js/

Alternative Approaches Considered

If the hosts file setup fails due to permission issues:

  1. Use IP address directly: Configure Vitest to use 127.0.0.1 instead of localhost
  2. Environment variable: Set HOST=0.0.0.0 before running tests
  3. Container network mode: Use --network=host in Docker-based CI

Impact

  • Enables coverage steps to complete successfully
  • Unblocks Phase 3 test coverage improvement work
  • No changes to repository code, only CI configuration

AI generated by Daily Test Coverage Improver

- Upgrade Node.js from v18 to v20 to meet Vite 7.x requirements
- Switch from jsdom to happy-dom for better CI environment compatibility
- Add happy-dom to installed dependencies
- Configure hosts file setup for DNS resolution in CI (requires sudo)

Changes address DNS resolution errors and Node version warnings seen in
coverage-steps.log. The happy-dom environment is lighter and more compatible
with containerized CI environments that may have DNS resolution limitations.
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.

0 participants