Skip to content

fix: run jest with --experimental-vm-modules for @oclif/core v4 dynamic imports (APPBLD-5077) - #933

Open
AnujVishwakarma-src wants to merge 1 commit into
adobe:masterfrom
AnujVishwakarma-src:APPBLD-5077-jest-esm
Open

fix: run jest with --experimental-vm-modules for @oclif/core v4 dynamic imports (APPBLD-5077)#933
AnujVishwakarma-src wants to merge 1 commit into
adobe:masterfrom
AnujVishwakarma-src:APPBLD-5077-jest-esm

Conversation

@AnujVishwakarma-src

@AnujVishwakarma-src AnujVishwakarma-src commented Sep 8, 2026

Copy link
Copy Markdown

Problem

CI on master (and the daily "npm install and run all unit tests" job, red since ~Aug 23) fails. The command-loading suites — use, add/ci, add/event, add/service, create, delete/service — throw:

TypeError: A dynamic import callback was invoked without --experimental-vm-modules

Root cause

@oclif/core v4 loads commands via dynamic import(). This repo commits no lockfile, so CI floats @oclif/core to the latest 4.x, and the unit-tests script ran plain jest -c jest.config.js without --experimental-vm-modules, so Jest can't execute the dynamic import. (Sibling repo @adobe/aio-cli-plugin-app-templates already runs jest with this flag and passes.)

Fix

  • Add cross-env devDependency (Windows-runner safe).
  • unit-tests: cross-env NODE_OPTIONS=--experimental-vm-modules jest -c jest.config.js.

Validation

Clean install + full suite:

  • 56 suites / 853 tests pass, 100% coverage
  • ✅ Lint clean

🤖 Generated with Claude Code

…ic imports (APPBLD-5077)

CI (and the daily master unit-test job) fails: the command-loading suites throw
"A dynamic import callback was invoked without --experimental-vm-modules".
@oclif/core v4 loads commands via dynamic import(); with no committed lockfile CI
floats to the latest 4.x, and the unit-tests script ran plain jest without the
ESM VM flag. Add cross-env (Windows-safe) and pass NODE_OPTIONS=--experimental-vm-modules,
matching @adobe/aio-cli-plugin-app-templates.

Validated: full suite 56 suites / 853 tests pass, 100% coverage, lint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant