Skip to content

POC, do not merge: ESM update and Vitest switchover#98

Draft
hannah-taub-1 wants to merge 10 commits into
masterfrom
esm-update
Draft

POC, do not merge: ESM update and Vitest switchover#98
hannah-taub-1 wants to merge 10 commits into
masterfrom
esm-update

Conversation

@hannah-taub-1
Copy link
Copy Markdown

@hannah-taub-1 hannah-taub-1 commented Jun 4, 2026

Description

POC: change this plugin to an ESM module.

  • update one older dependency (fs-extra)
  • switch from Jest to Vitest, as Jest does not support ESM without --experimental-vm-modules
  • refactor code structure to be ESM-compatible

Related Issue

https://jira.corp.adobe.com/browse/ACNA-4658

Motivation and Context

Test how feasible upgrading plugins in aio-cli (entirely CommonJS) to ESM would be. Many of our deprecated dependencies are ESM-only if you want the non-deprecated versions, and we do not want to lazy load all our dependencies.

How Has This Been Tested?

Unit tests: made sure they run with 100% coverage (including adding a few for index.js).
End-to-end: linked plugin to local aio-cli and ran all three aio certificate commands without issues.

Possible issue: The ESM version does print the warning "@adobe/aio-cli-plugin-certificate is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead." The plugin does not use Typescript and seems to function fine in spite of this warning, but it should still be noted.

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.

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 to ESM and from Jest to Vitest. The changes are well-structured and consistent across all files. One minor issue exists in the fingerprint test where a commandPath variable is declared but never used after the refactor, and there's a subtle ordering issue in verify.js where const debug is declared before an import statement.

📝 2 suggestion(s) - Please review inline comments below.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread test/commands/certificate/fingerprint.test.js
Comment thread src/commands/certificate/verify.js
@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!

github-actions[bot]
github-actions Bot previously approved these changes Jun 4, 2026
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 and consistent across all files. Two previously raised issues remain: the commandPath variable in fingerprint.test.js is still declared but only used for dynamic imports in beforeAll blocks (not at the top level where TheCommand is now imported directly), and in generate.js the const debug assignment is placed before a blank line after imports but is still mixed in without a blank line separator from the imports. Overall the migration is solid.

LGTM! This PR looks good to merge.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread test/commands/certificate/fingerprint.test.js Outdated
Comment thread src/commands/certificate/generate.js
@github-actions github-actions Bot dismissed their stale review June 4, 2026 14:09

Superseded by new review

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 diff migrates the project from CommonJS/Jest to ESM/Vitest cleanly. The re-raised issues about commandPath placement and the missing blank line before const debug in generate.js are still present. No new significant issues found — the module mocking pattern in fingerprint.test.js is a reasonable workaround for vitest's lack of isolateModules, and the overall migration is correct.

🔄 2 re-raised suggestion(s) from previous review

Findings (line numbers not in diff):

  • test/commands/certificate/fingerprint.test.js (line 15): [Re-raised] commandPath is declared at the top level but TheCommand is imported dynamically inside beforeAll blocks. The top-level declaration is misleading — it suggests TheCommand was loaded via this path at module load time, but it wasn't. Consider adding a clarifying comment.

💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread src/commands/certificate/generate.js
@github-actions github-actions Bot dismissed their stale review June 4, 2026 14:41

Superseded by new review

@hannah-taub-1
Copy link
Copy Markdown
Author

/review

github-actions[bot]
github-actions Bot previously approved these changes Jun 4, 2026
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

The migration from CommonJS to ESM and from Jest to Vitest is clean and well-executed. The previous suggestion about the missing blank line in generate.js has been addressed — the blank line is now present between the last import and const debug. No significant issues remain.

LGTM! This PR looks good to merge.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

@github-actions github-actions Bot dismissed their stale review June 4, 2026 14:47

Superseded by new review

Copy link
Copy Markdown
Member

@purplecabbage purplecabbage left a comment

Choose a reason for hiding this comment

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

just a nit about left over commented out // requires()

Comment thread test/commands/certificate/fingerprint.test.js
github-actions[bot]
github-actions Bot previously approved these changes Jun 4, 2026
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 PR migrates the project from CommonJS to ESM and from Jest to Vitest. The changes are well-structured and consistent across all files. The migration approach for handling module isolation in fingerprint tests is reasonable given Vitest's limitations with isolateModules. One minor issue exists in the .gitignore file.

LGTM! This PR looks good to merge.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread .gitignore Outdated
junit.xml
package-lock.json
.claude
.cursor/ No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing newline at end of file

Suggested change
.cursor/
.cursor/

@github-actions github-actions Bot dismissed their stale review June 4, 2026 19:18

Superseded by new review

github-actions[bot]
github-actions Bot previously approved these changes Jun 4, 2026
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 diff migrates the project from CommonJS to ESM and from Jest to Vitest. The changes are well-structured and consistent. The previous .gitignore newline issue has been resolved. No significant issues found.

LGTM! This PR looks good to merge.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

@github-actions github-actions Bot dismissed their stale review June 4, 2026 19:22

Superseded by new review

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 PR migrates the project from CommonJS to ESM and from Jest to Vitest. The changes are consistent and well-structured. One minor issue: the copyright year in the new test files says '2026', which appears to be a typo.

LGTM! This PR looks good to merge.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread test/commands/certificate/index.test.js
Comment thread test/vitest.setup.js
Comment thread vitest.config.js
@github-actions github-actions Bot dismissed their stale review June 4, 2026 20:28

Superseded by new review

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.

2 participants