mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
test(bundler): add comprehensive ESM/CJS syntax edge case tests for code splitting
Add 42 new edge case tests covering all permutations of ESM and CJS syntax:
- require() variations: require of ESM, destructuring default, mixed with import
- await import() variations: top-level await, inside async functions, conditional
- module.exports variations: object pattern, class, function, exports.x pattern
- export { x } from: basic, renamed, chained through multiple files
- export * from: basic, multiple sources, as namespace
- export { default } from: basic, renamed, named to default
- Circular dependencies: ESM, CJS, export star, three-way
- Mixed syntax: ESM importing CJS requiring ESM, CJS requiring ESM importing CJS
- __esModule interop: CJS with __esModule flag, dynamic imports
- Live bindings: getter/setter patterns, CJS behavior differences
All tests include both ESM and CJS output format variants where applicable.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in: