Skip to content

[#2499] Fixed Jest CI failure when no tests are present.#2503

Merged
AlexSkrypnyk merged 3 commits into
mainfrom
feature/2499-jest-no-tests
May 21, 2026
Merged

[#2499] Fixed Jest CI failure when no tests are present.#2503
AlexSkrypnyk merged 3 commits into
mainfrom
feature/2499-jest-no-tests

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented May 21, 2026

Copy link
Copy Markdown
Member

Closes #2499

Summary

CI failed when no Jest tests existed - most commonly after the demo content (ys_demo module) was deselected during install, removing the only seeded ys_demo.test.js. jest --coverage would exit 1 with "No tests found", failing the "Test with Jest" step on both CircleCI and GitHub Actions. Added --passWithNoTests so an empty Jest suite exits 0 while real test failures continue to fail the build.

Also lifted the explicit-permission gate on ahoy update-snapshots in .vortex/CLAUDE.md and .vortex/installer/CLAUDE.md, now that the parallel --jobs=8 runner brings a full snapshot regeneration down to ~3 minutes.

Changes

Jest CI fix

  • package.json: jest --coveragejest --coverage --passWithNoTests.
  • .vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php: added a sub-test Assert Jest passes when there are no tests to subtestAhoyTestJs(). The sub-test backs up ys_demo.test.js, removes it from host and container, runs ahoy test-js, and asserts the output contains No tests found, exiting with code 0, then restores the file.
  • .vortex/installer/tests/Fixtures/handler_process/**/package.json: 11 fixture files regenerated via ahoy update-snapshots to mirror the new test script.

Documentation tidy

  • .vortex/CLAUDE.md: removed the "Commands Requiring Permission" section and the (REQUIRES PERMISSION) / (requires permission) annotations around ahoy update-snapshots.
  • .vortex/installer/CLAUDE.md: replaced "the user will run the snapshot update themselves" with a direct instruction to run ahoy update-snapshots, and decoupled the installer-video permission note from update-snapshots.

Before / After

                  CI: "Test with Jest" step
                  └─ yarn test → jest --coverage

  Before                                    After
  ──────                                    ─────
  Tests present:                            Tests present:
    PASS / FAIL based on assertions           PASS / FAIL based on assertions
                                              (unchanged)
  Tests absent:                             Tests absent:
    ✗ exit 1                                  ✓ exit 0
    "No tests found, exiting with code 1"     "No tests found, exiting with code 0"
    → CI job fails                            → CI job passes

Summary by CodeRabbit

  • Documentation

    • Streamlined template maintenance guide with updated snapshot update instructions and workflow clarifications
    • Enhanced installer documentation with clearer fixture regeneration procedures and permission requirements
  • Tests

    • Extended test suite to handle scenarios where no tests are found
    • Updated test execution to pass gracefully when tests are unavailable

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown

Walkthrough

The PR addresses a CI failure when no Jest tests exist by adding the --passWithNoTests flag to the npm test script, adds test coverage for the no-tests scenario, and updates documentation to clarify command permissions and fixture regeneration behavior.

Changes

Jest No-Tests Scenario Handling

Layer / File(s) Summary
Jest configuration and no-tests test coverage
package.json, .vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php
The test script now runs Jest with --passWithNoTests in addition to --coverage. A new Ahoy test case simulates the no-tests-found scenario by removing the example Jest test file, executing ahoy test-js expecting success with a "No tests found" message, then restoring and syncing the file.
Documentation updates: commands and permissions
.vortex/CLAUDE.md, .vortex/installer/CLAUDE.md
Template maintenance guide removes the "requires permission" qualifier from ahoy update-snapshots in Quick Commands and eliminates the entire "Commands Requiring Permission" section. Installer docs clarify that fixtures including _baseline/ are regenerated via ahoy update-snapshots when root templates change, and that installer video generation requires explicit user permission.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 When tests go missing, no more despair,
Jest now passes with nothing to share,
Our Ahoy suite dances the no-tests ballet,
And docs now clarify what's ours to say!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive Documentation updates to remove permission requirements for ahoy update-snapshots are related to the snapshot regeneration needed for the fixture changes but extend beyond the core issue scope. Clarify whether documentation changes removing permission requirements are essential for this fix or should be separated into a distinct PR addressing snapshot workflow improvements.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main fix: adding --passWithNoTests flag to Jest to handle cases where no tests exist, preventing CI failures.
Linked Issues check ✅ Passed The pull request successfully addresses issue #2499 by modifying the test script to use --passWithNoTests, adding verification tests, and updating fixtures to reflect the change.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/2499-jest-no-tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@AlexSkrypnyk AlexSkrypnyk added this to the 1.39.0 milestone May 21, 2026
@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (squash) May 21, 2026 21:49
@github-actions

Copy link
Copy Markdown

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.53% (201/204)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.vortex/CLAUDE.md:
- Around line 79-81: Update the doc line about snapshot regeneration to state
that snapshots are generated from the code exported from git HEAD (the test
harness uses git archive --format=tar HEAD), so uncommitted working-tree changes
aren’t included; reference the command `ahoy update-snapshots` and the test
helper FunctionalTestCase::fixtureExportCodebase to make it clear the
export-from-HEAD behavior is what determines the baseline rather than a generic
“committed baseline” comparison.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a0d75e18-8319-4f19-b4da-ad67c9882d93

📥 Commits

Reviewing files that changed from the base of the PR and between adfe0e4 and b7dacd2.

⛔ Files ignored due to path filters (11)
  • .vortex/installer/tests/Fixtures/handler_process/_baseline/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_acquia/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_eslint/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_circleci/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_jest/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_jest_circleci/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_circleci/package.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/package.json is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (4)
  • .vortex/CLAUDE.md
  • .vortex/installer/CLAUDE.md
  • .vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php
  • package.json

Comment thread .vortex/CLAUDE.md
@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.53% (201/204)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@codecov

codecov Bot commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.51%. Comparing base (4421643) to head (b7dacd2).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2503      +/-   ##
==========================================
- Coverage   79.97%   79.51%   -0.46%     
==========================================
  Files         129      122       -7     
  Lines        6895     6736     -159     
  Branches       47        3      -44     
==========================================
- Hits         5514     5356     -158     
+ Misses       1381     1380       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexSkrypnyk AlexSkrypnyk merged commit 0e1b569 into main May 21, 2026
30 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/2499-jest-no-tests branch May 21, 2026 22:04
@github-project-automation github-project-automation Bot moved this from BACKLOG to Release queue in Vortex 1.x May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Released in 1.39.0

Development

Successfully merging this pull request may close these issues.

CI fails if there are no Jest tests

1 participant