Skip to main content

❓ Why Were No Tests Generated?

If your CLI command or GitHub Action finished without generating any test files, this guide covers common reasons and how to fix them.

This applies to all agents:

  • early generate-pr
  • early generate-commit
  • early generate-folder

🧩 1. CLI Not Installed​

If you're using a CLI-based agent (generate-pr, generate-commit, or generate-folder), ensure the CLI is correctly installed.

βœ… Fix​

  • If using GitHub Actions: install via npm install -g @earlyai/cli
  • If using Jenkins or CircleCI: make sure the CLI is installed on the runner
  • See setup steps in: NPM Authentication

πŸ“‰ 2. Coverage Command Failed​

If the CLI cannot collect coverage, it cannot detect low-covered functions to generate tests for.

2a. Jest Is Not Installed or Configured​

  • Ensure jest is present in your package.json
  • Ensure npx jest or npm test works locally

2b. Coverage Command Needs to Be Overridden​

In some projects, the default coverage command does not match your setup.

βœ… Fix​

Override the variable COVERAGE_COMMAND


⚠️ 3. Test Validation Failed​

After test generation, the CLI runs your test command to validate that generated code compiles and passes.

If validation fails:

  • Files are not committed
  • The logs will mention a failed test run

βœ… Fix​

Override your test command with one that works in your project:

export TEST_COMMAND="xxx"

Make sure Jest can run successfully in CI with generated test files.


🧼 4. Lint or Format Rules Rejected the Commit​

Your repository might enforce linting or formatting (e.g., ESLint, Prettier, husky, or lint-staged).
If the generated test files fail these rules, the commit will not go through.

βœ… Fix​

Add custom commands so that the CLI can auto-fix the files before attempting to commit.

export LINT_COMMAND="npx --no eslint $early_filename --fix"
export PRETTIER_COMMAND="npx --no prettier $early_filename --write"

These commands will be run before validation and commit.
See: Lint & Formatting Guide


πŸ” 5. SCM Token Lacks Permissions​

If your TOKEN variable lacks permissions to:

  • Read repository metadata
  • Write commits
  • Push code

...then no test files will be committed, even if generation succeeds.

βœ… Fix​

  • Use a classic or fine-grained Personal Access Token (PAT)
  • Verify required scopes: repo, contents: write, pull_requests: write
  • See: Token Setup

πŸ” 6. The Branch Was Updated After Pull​

If another commit was pushed after your job started, Git will reject the CLI’s commit.

βœ… Fix​

  • Re-run the job to regenerate tests on the updated branch

🚫 7. No Testable Code Found​

If the PR or commit does not include any testable logic, no tests will be generated.

βœ… What This Means​

  • The agent looks for JavaScript or TypeScript files
  • With exported or public functions
  • In supported file types (e.g., .ts, .js)

Non-code changes, config files, and utility updates are ignored.


🎯 8. All Code Already Covered​

By default, agents only target functions with 0% coverage.

If your changes include functions that are partially or fully covered, the CLI will skip them.

βœ… Fix​

  • Confirm via your coverage report that the function has no coverage
  • Coverage threshold will become configurable in the future