test(formatter): add tests for import sorting in ambient modules#22072
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
Adds formatter regression tests to validate that sortImports correctly sorts import declarations within TypeScript ambient module bodies (declare module "…" { … }) without affecting surrounding top-level import chunks.
Changes:
- Register a new
ambient_modulestest module in the import-sorting IR transform test suite. - Add coverage for sorting inside a single ambient module, across mixed top-level + ambient scopes, and across multiple ambient modules.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_formatter/tests/ir_transform/sort_imports/mod.rs | Adds the new ambient-module-focused test module to the suite. |
| crates/oxc_formatter/tests/ir_transform/sort_imports/ambient_modules.rs | Introduces targeted tests ensuring import sorting is scoped correctly inside ambient modules and across chunk boundaries. |
Merging this PR will not alter performance
Comparing Footnotes
|
4705d36 to
484b615
Compare
Well you implemented it, not me! |
Merge activity
|
484b615 to
2c7a2ea
Compare

Add tests for sorting imports within ambient modules. e.g.:
This is supported already, but there were no tests for it.