Skip to content

Migrate from CJS to ESM and from Jest to Vitest ( claude for comparison )#99

Open
purplecabbage wants to merge 1 commit into
masterfrom
esm-update-claude
Open

Migrate from CJS to ESM and from Jest to Vitest ( claude for comparison )#99
purplecabbage wants to merge 1 commit into
masterfrom
esm-update-claude

Conversation

@purplecabbage
Copy link
Copy Markdown
Member

  • add "type": "module" and convert all src/bin to import/export
  • rename bin/run -> bin/run.js for ESM resolution
  • bump fs-extra ^9 -> ^11
  • swap jest/eslint-plugin-jest for vitest/@vitest/coverage-v8/@vitest/eslint-plugin
  • add vitest.config.js, replace test/jest.setup.js with test/vitest.setup.js
  • rewrite fingerprint forge mocking using vi.resetModules + vi.doMock/doUnmock (vitest has no isolateModules)
  • add index command test to keep coverage at 100%

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

- add "type": "module" and convert all src/bin to import/export
- rename bin/run -> bin/run.js for ESM resolution
- bump fs-extra ^9 -> ^11
- swap jest/eslint-plugin-jest for vitest/@vitest/coverage-v8/@vitest/eslint-plugin
- add vitest.config.js, replace test/jest.setup.js with test/vitest.setup.js
- rewrite fingerprint forge mocking using vi.resetModules + vi.doMock/doUnmock
  (vitest has no isolateModules)
- add index command test to keep coverage at 100%

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

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

🤖 PR Reviewer

This is a clean migration from CommonJS/Jest to ESM/Vitest. The changes are well-structured, consistent, and follow ESM best practices throughout. The test refactoring correctly handles the lack of isolateModules in Vitest using vi.resetModules() and dynamic imports. No significant issues found.

LGTM! This PR looks good to merge.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

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