refactor(unit,core.unit)!: migrate to NodeNext with dual CJS/ESM builds#863
Merged
Conversation
Migrate @suites/unit and @suites/core.unit to NodeNext-compatible module resolution with dual CommonJS and ESM builds. This ensures proper module resolution in modern Node.js environments while maintaining backward compatibility with CommonJS consumers. Changes: - Add dual build configurations (tsconfig.cjs.json, tsconfig.esm.json) - Update build scripts to generate both CJS and ESM outputs - Add .js extensions to all relative imports (ESM requirement) - Enhance package.json exports with conditional types for import/require - Use "module": "esnext" with "moduleResolution": "bundler" for ESM builds - Maintain "module": "commonjs" for CJS builds Breaking Changes: - Requires TypeScript 5.0+ to build from source (uses "moduleResolution": "bundler") - Published packages remain compatible with TypeScript 4.x+ consumers Relates to #811 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #863 +/- ##
=======================================
Coverage 92.54% 92.54%
=======================================
Files 26 26
Lines 590 590
Branches 99 99
=======================================
Hits 546 546
Misses 35 35
Partials 9 9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add moduleNameMapper to Jest configuration to handle .js extensions in
TypeScript source imports. This allows Jest with ts-jest to properly
resolve imports like `import { foo } from './bar.js'` to their
corresponding `.ts` source files.
The regex `^(\\.{1,2}/.*)\\.js$` strips .js extensions from relative
imports, enabling proper module resolution during test execution.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Update Jest configuration to map workspace packages (@suites/*) to their TypeScript source files instead of compiled dist files. This allows tests to run without requiring packages to be built first. Uses absolute paths from monorepo root to handle both flat (/packages/unit) and nested (/packages/di/inversify) package structures consistently. Mappings added: - @suites/core.unit -> packages/core/src/index.ts - @suites/types.common -> packages/types/common/index.ts - @suites/types.di -> packages/types/di/src/index.ts - @suites/types.doubles -> packages/types/doubles/index.d.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
omermorad
added a commit
that referenced
this pull request
Oct 24, 2025
…ds (#863) Migrate @suites/unit and @suites/core.unit to NodeNext-compatible module resolution with dual CommonJS and ESM builds. This ensures proper module resolution in modern Node.js environments while maintaining backward compatibility with CommonJS consumers. Changes: - Add dual build configurations (tsconfig.cjs.json, tsconfig.esm.json) - Update build scripts to generate both CJS and ESM outputs - Add .js extensions to all relative imports (ESM requirement) - Enhance package.json exports with conditional types for import/require - Use "module": "esnext" with "moduleResolution": "bundler" for ESM builds - Maintain "module": "commonjs" for CJS builds Relates to #811
omermorad
added a commit
that referenced
this pull request
Oct 26, 2025
…ds (#863) Migrate @suites/unit and @suites/core.unit to NodeNext-compatible module resolution with dual CommonJS and ESM builds. This ensures proper module resolution in modern Node.js environments while maintaining backward compatibility with CommonJS consumers. Changes: - Add dual build configurations (tsconfig.cjs.json, tsconfig.esm.json) - Update build scripts to generate both CJS and ESM outputs - Add .js extensions to all relative imports (ESM requirement) - Enhance package.json exports with conditional types for import/require - Use "module": "esnext" with "moduleResolution": "bundler" for ESM builds - Maintain "module": "commonjs" for CJS builds Relates to #811
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrate
@suites/unitand@suites/core.unitto NodeNext-compatible module resolution with dual CommonJS and ESM builds. This ensures proper module resolution in modern Node.js environments while maintaining backward compatibility with CommonJS consumers.Changes:
tsconfig.cjs.json,tsconfig.esm.json).jsextensions to all relative imports (ESM requirement)"module": "esnext"with"moduleResolution": "bundler"for ESM builds"module": "commonjs"for CJS buildsRelates to #811