Skip to content

Comments

test: validate publishConfig.exports matches exports field#6950

Merged
sapphi-red merged 4 commits intomainfrom
copilot/add-exports-validation-tests
Nov 12, 2025
Merged

test: validate publishConfig.exports matches exports field#6950
sapphi-red merged 4 commits intomainfrom
copilot/add-exports-validation-tests

Conversation

Copy link
Contributor

Copilot AI commented Nov 12, 2025

Prevents issues like #6925 where publishConfig.exports and exports fields in package.json have mismatched keys, causing unexpected behavior in published packages.

Changes

  • Added exports-consistency.test.ts to packages/rolldown/tests/
  • Added exports-consistency.test.ts to packages/pluginutils/src/

Both tests use expect().toStrictEqual() to compare sorted keys:

const exportsKeys = Object.keys(pkg.exports).sort();
const publishExportsKeys = Object.keys(pkg.publishConfig.exports).sort();

expect(exportsKeys).toStrictEqual(publishExportsKeys);

Tests fail with clear diff output when keys mismatch, catching the issue during CI.

<issue_title>CI: validate if publicConfig#exports is consistient with local exports field</issue_title>
><issue_description>Wanna catch #6925 in advance</issue_description>
>
><agent_instructions>Add tests to packages/rolldown/tests and packages/pluginutils which does something like assert.deepStrictEqual(Object.keys(pkg.exports), Object.keys(pkg.publishConfig.exports))</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
>
>
>

Original prompt

This section details on the original issue you should resolve

<issue_title>CI: validate if publicConfig#exports is consistient with local exports field</issue_title>
<issue_description>Wanna catch #6925 in advance</issue_description>

<agent_instructions>Add tests to packages/rolldown/tests and packages/pluginutils which does something like assert.deepStrictEqual(Object.keys(pkg.exports), Object.keys(pkg.publishConfig.exports))</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 12, 2025

How to use the Graphite Merge Queue

Add the label graphite: merge to this PR to add it to 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.

@netlify
Copy link

netlify bot commented Nov 12, 2025

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 24cc82a
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/69140ed631a2dd000769f120
😎 Deploy Preview https://deploy-preview-6950--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI changed the title [WIP] Add tests for publicConfig exports consistency test: validate publishConfig.exports matches exports field Nov 12, 2025
Copilot AI requested a review from sapphi-red November 12, 2025 03:31
@sapphi-red
Copy link
Member

@copilot use expect().toStrictEqual

Copy link
Contributor Author

Copilot AI commented Nov 12, 2025

@copilot use expect().toStrictEqual

Updated to use expect().toStrictEqual() in commit 2851e08. Both tests still pass and correctly fail when inconsistencies are detected.

@sapphi-red sapphi-red marked this pull request as ready for review November 12, 2025 04:17
@sapphi-red sapphi-red requested a review from hyf0 November 12, 2025 04:18
@sapphi-red sapphi-red force-pushed the copilot/add-exports-validation-tests branch from 91d1278 to 24cc82a Compare November 12, 2025 04:36
@sapphi-red sapphi-red enabled auto-merge (squash) November 12, 2025 04:36
@sapphi-red sapphi-red merged commit 5760a76 into main Nov 12, 2025
24 checks passed
@sapphi-red sapphi-red deleted the copilot/add-exports-validation-tests branch November 12, 2025 04:48
shulaoda pushed a commit that referenced this pull request Nov 12, 2025
## [1.0.0-beta.50] - 2025-11-12

### 🚀 Features

- rolldown: oxc_resolver v11.13.2 (#6956) by @Boshen
- rolldown: oxc v0.97.0 (#6940) by @Boshen

### 🐛 Bug Fixes

- handle error when creating output chunk directories (#6953) by @sapphi-red
- throw error if `experimental.hmr` is set for APIs other than `dev` (#6860) by @Copilot
- apply output.paths transformation to chunk.imports and generated code (#6923) by @Copilot

### 🚜 Refactor

- use `anyhow::Context::context` where applicable (#6952) by @sapphi-red
- dev: use actor design pattern and allow to recover from intial build error (#6936) by @hyf0

### 📚 Documentation

- add sitemap (#6929) by @mdong1909

### 🧪 Testing

- validate publishConfig.exports matches exports field (#6950) by @Copilot
- re-enable output/paths/function test (#6934) by @Copilot

### ⚙️ Miscellaneous Tasks

- rename `rolldown_watcher` to `rolldown_fs_watcher` (#6958) by @hyf0
- enable trust policy (#6948) by @iiio2
- deps: update napi (#6951) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.17.6 (#6947) by @renovate[bot]
- deps: update npm packages (#6937) by @renovate[bot]
- deps: update dependency tsdown to v0.16.2 (#6933) by @renovate[bot]

### ❤️ New Contributors

* @mdong1909 made their first contribution in [#6929](#6929)

Co-authored-by: sapphi-red <[email protected]>
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.

CI: validate if publicConfig#exports is consistient with local exports field

3 participants