β 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-prearly generate-commitearly 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
jestis present in yourpackage.json - Ensure
npx jestornpm testworks 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