Skip to content

feat(esm): Revert #355, #359 and #360#361

Merged
Tobbe merged 3 commits into
mainfrom
tobbe-esm-prep-4
Aug 9, 2025
Merged

feat(esm): Revert #355, #359 and #360#361
Tobbe merged 3 commits into
mainfrom
tobbe-esm-prep-4

Conversation

@Tobbe
Copy link
Copy Markdown
Member

@Tobbe Tobbe commented Aug 9, 2025

Debugging CI issue with web side tests on Windows

If CI passes for this PR, I'll merge it, and then go back to #358 and see if that passes, and then pick up with adding more and more code from #355 as I was doing

@Tobbe Tobbe added this to the next-release milestone Aug 9, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 9, 2025

Deploy Preview for cedarjs canceled.

Name Link
🔨 Latest commit 91cb36b
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/6897c9ac7936140008a2b9db

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR reverts substantial ESM (ECMAScript Module) preparation work by removing testing infrastructure, build configurations, and Vite plugins that were recently added in PRs #355, #359, and #360. The changes systematically remove Vitest-based testing utilities and revert back to simpler build processes to address CI failures on Windows.

Key changes include:

  1. Testing Infrastructure Removal: Completely removes Vitest-specific testing plugins and configurations from the @cedarjs/testing package, including auto-import plugins, router import transformations, database tracking plugins, and custom Vitest environments. The packages/testing/src/api/vitest/index.ts and packages/testing/src/web/vitest/index.ts files are emptied, removing all plugin exports.

  2. Build System Simplification: Reverts complex build logic in packages/testing/build.mts back to simple buildCjs() calls, removing custom esbuild configuration that handled import.meta.glob compatibility for CommonJS builds.

  3. Package Configuration Rollback: Removes export paths for vitest-related modules from package.json files, eliminates dependencies like unplugin-auto-import, and removes TypeScript project references between packages to decouple build dependencies.

  4. Vite Plugin Cleanup: Removes test-mode functionality from the Cedar Vite plugin, eliminating conditional plugin registration based on test environments and removing imports of testing-related plugins.

  5. Mock System Simplification: Reverts MockRouter and MockProviders components to simpler implementations, removing dynamic imports of user routes via globRoutesImporter.ts and falling back to more traditional module alias approaches.

These changes represent a significant rollback of ESM migration work, moving from a sophisticated dual Jest/Vitest testing setup back to a Jest-focused approach. The revert affects the entire testing ecosystem but maintains core functionality while eliminating Windows-specific compatibility issues.

Confidence score: 2/5

  • This PR introduces significant risk by removing substantial testing infrastructure without clear replacement mechanisms
  • Score reflects the large scope of removed functionality that could break existing test setups and development workflows
  • Pay close attention to all testing-related files and ensure adequate testing coverage remains after these removals

24 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

},
},
})
await buildCjs()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: Potential issue: files using import.meta.glob in src/web/globRoutesImporter.ts may not work properly in CJS builds without the custom handling that was removed

@Tobbe Tobbe merged commit c450fed into main Aug 9, 2025
50 of 52 checks passed
@Tobbe Tobbe deleted the tobbe-esm-prep-4 branch August 9, 2025 22:31
Tobbe added a commit that referenced this pull request Aug 22, 2025
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