feat(administration): fail early when an extension runs the Jest harness with another Jest major by gweiermann · Pull Request #21846 · shopware/shopware · GitHub
Skip to content

feat(administration): fail early when an extension runs the Jest harness with another Jest major - #21846

Closed
Gerrit Weiermann (gweiermann) wants to merge 3 commits into
feat/admin-extension-test-commandfrom
feat/admin-extension-jest-version-check
Closed

Gerrit Weiermann (gweiermann) wants to merge 3 commits into
feat/admin-extension-test-commandfrom
feat/admin-extension-jest-version-check

Conversation

@gweiermann

Copy link
Copy Markdown
Contributor

1. Why is this change necessary?

Stacked on #21822. Extensions can run their specs on the Administration's Jest harness (#21797) with their own Jest installation, as SwagCommercial does.

That only works while the extension's Jest has the Administration's major version: the harness's test environment and transformers come from the Administration's Jest. Once the Administration moves to the next Jest major, an extension still on the old one fails with errors deep inside Jest that do not point at the cause.

2. What does this change do, exactly?

  • The Jest config factory compares the major of the Jest that loads the config with the Administration's and fails early with both versions, the jest@^N to install, and admin:test-extensions as the alternative
  • The running Jest is read from the jest-config package in the module cache, the package that imports config files; the Jest bin path can name another Jest (import-local hand-over, programmatic runCLI)
  • No check when no or several jest-config versions are loaded, e.g. when a script builds the config

3. Describe each step to reproduce the issue or behaviour.

In an extension with its own Jest of another major than the Administration's, composing the factory as described in #21797:

npx jest
This Jest config is loaded by Jest 30.2.0, but the Administration test harness in … is built for Jest 29.0.0. Install Jest 29 for your extension (`npm install --save-dev jest@^29`), or run the specs with `composer admin:test-extensions` …

With the same major, nothing changes.

4. Please link to the relevant issues (if any).

5. Checklist

  • I have written tests and verified that they fail without my change
  • I have updated developer-facing release notes if this change is relevant for external developers:
    • Add a short entry to RELEASE_INFO-6.<current major line>.md in the upcoming version section for informational changes: what changed, who is affected, and how to adapt.
    • Add an entry to UPGRADE-6.<next major>.md for breaking changes and deprecations: what changed, who is affected, and how to adapt.
    • See the Documenting a Release Process for details.
  • I have written or adjusted the documentation and agent skills according to my changes
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I have read the contribution requirements and fulfilled them

…ess with another jest major

The harness's test environment and transformers are built against the
Administration's Jest. An extension that runs its specs with its own Jest
of another major now gets an error naming both versions, the Jest major to
install and admin:test-extensions as the alternative, instead of failing on
API mismatches inside the harness.

The running Jest is read from the jest-config package in the module cache,
which is the package that imports the config file. When no single
jest-config is loaded, e.g. when a script calls the factory, the check is
skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gweiermann Gerrit Weiermann (gweiermann) added component/administration domain/framework Responsible for the framework-level code includes core, administration, storefront, and frontends labels Oct 21, 2026
@github-actions github-actions Bot added the waiting-on/nobody The PR is a draft or parked. Set daily by the waiting-on-report workflow. label Oct 21, 2026
@explore-openapi

explore-openapi Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.58%. Comparing base (08c431f) to head (e18793d).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                        Coverage Diff                         @@
##           feat/admin-extension-test-command   #21846   +/-   ##
==================================================================
  Coverage                              71.58%   71.58%           
==================================================================
  Files                                   5969     5968    -1     
  Lines                                 218989   218984    -5     
  Branches                               12099    12099           
==================================================================
- Hits                                  156768   156766    -2     
+ Misses                                 58379    58374    -5     
- Partials                                3842     3844    +2     
Flag Coverage Δ
jest-admin 68.70% <ø> (+<0.01%) ⬆️
jest-storefront 72.53% <ø> (ø)
phpunit-migration 95.02% <ø> (ø)
phpunit-unit 69.41% <ø> (+<0.01%) ⬆️
vitest-storefront-components 57.82% <ø> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/administration domain/framework Responsible for the framework-level code includes core, administration, storefront, and frontends waiting-on/nobody The PR is a draft or parked. Set daily by the waiting-on-report workflow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant