Skip to content

Critical: Missing /etc/hosts blocks all vitest-based test coverage (PRs #203, #217, #245, #246, #79, #78) #248

@github-actions

Description

@github-actions

Problem

All JavaScript/TypeScript test PRs are blocked by a missing /etc/hosts file in the GitHub Actions CI environment, preventing vitest from resolving localhost.

Error

⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯
Error: getaddrinfo EAI_AGAIN localhost
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:internal/dns/promises:86:17) {
  errno: -3001,
  code: 'EAI_AGAIN',
  syscall: 'getaddrinfo',
  hostname: 'localhost'
}

Impact

Blocked PRs (817 lines of code):

Coverage blocked: Cannot measure test coverage for any JS/TS files, blocking the entire Daily Test Coverage Improver workflow Phase 3.

Root Cause

The GitHub Actions runner environment is missing /etc/hosts file, which vitest's internal server requires for localhost DNS resolution.

Verification:

$ cat /etc/hosts
cat: /etc/hosts: No such file or directory

Solution

Add a step to .github/actions/daily-test-improver/coverage-steps/action.yml before running tests:

    # Fix missing /etc/hosts file that causes vitest DNS resolution errors
    - name: Create /etc/hosts if missing
      shell: bash
      run: |
        if [ ! -f /etc/hosts ]; then
          echo "=== /etc/hosts missing, creating it ===" | tee -a coverage-steps.log
          echo "127.0.0.1 localhost" | sudo tee /etc/hosts
          echo "::1 localhost" | sudo tee -a /etc/hosts
          echo "=== /etc/hosts created ===" | tee -a coverage-steps.log
        else
          echo "=== /etc/hosts exists ===" | tee -a coverage-steps.log
          cat /etc/hosts | tee -a coverage-steps.log
        fi

This should be inserted as the first step before "Set up Node.js".

Attempted Workarounds (All Failed)

  • ✓ Changed vitest environment to jsdom
  • ✓ Added pool configuration
  • ✓ Disabled watch mode
  • ✓ Tried NODE_OPTIONS DNS settings
  • ❌ Cannot create /etc/hosts manually (no sudo in test runs)

Benefits of Fix

Once this is fixed:

  1. All 6 blocked test PRs can be validated and merged
  2. Test coverage can be measured for 817 lines of critical code
  3. Daily Test Coverage Improver workflow Phase 3 can proceed
  4. Future test PRs won't encounter this issue

Priority

Critical - This blocks the entire test coverage improvement workflow and prevents validation of security-critical GDPR compliance code.

Related

AI generated by Daily Test Coverage Improver

To add this workflow in your repository, run gh aw add githubnext/agentics/workflows/daily-test-improver.md@e43596e069e74a65cd7d93315091672d278c2642. See usage guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions