Title: mock.module: consolidate `defaultExport` + `namedExports` into `exports` · Issue #58443 · nodejs/node · GitHub
Open Graph Title: mock.module: consolidate `defaultExport` + `namedExports` into `exports` · Issue #58443 · nodejs/node
X Title: mock.module: consolidate `defaultExport` + `namedExports` into `exports` · Issue #58443 · nodejs/node
Description: Currently, mock.module's options expects defaultExport and namedExports separately. We are not aware of a reason to separate them, and it's inconsistent with other major testing frameworks/utilities (such as Jest). function mock__default...
Open Graph Description: Currently, mock.module's options expects defaultExport and namedExports separately. We are not aware of a reason to separate them, and it's inconsistent with other major testing frameworks/utilitie...
X Description: Currently, mock.module's options expects defaultExport and namedExports separately. We are not aware of a reason to separate them, and it's inconsistent with other major testing frameworks/...
Opengraph URL: https://github.com/nodejs/node/issues/58443
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mock.module: consolidate `defaultExport` + `namedExports` into `exports`","articleBody":"Currently, `mock.module`'s `options` expects `defaultExport` and `namedExports` separately. We are not aware of a reason to separate them, and it's inconsistent with other major testing frameworks/utilities (such as Jest).\n\n```diff\nfunction mock__default() {…}\nfunction mock__foo() {…}\n\nmock.module('example.mjs', {\n- defaultExport: mock__default,\n- namedExports: {\n+ exports: {\n+ default: mock__default,\n foo: mock__foo,\n },\n});\n```\n\nThe plan would be:\n1. Immediately introduce `options.exports`\n * alias `defaultExport` \u0026 `namedExports` into `options.exports`\n2. Immediately flag `defaultExport` \u0026 `namedExports` deprecated\n3. Provide a userland-migration to automatically transform old to new\n4. In node 25.x remove `defaultExport` \u0026 `namedExports`","author":{"url":"https://github.com/JakobJingleheimer","@type":"Person","name":"JakobJingleheimer"},"datePublished":"2025-05-24T09:30:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/58443/node/issues/58443"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8e1f60a1-f83f-06c2-df25-303d15157c21 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D9B4:1138FF:114D660:1795469:6A4D6B0F |
| html-safe-nonce | 86b72043e483b0b62941d9b1c07b6c21a82299b2755bbbc88da1ef4921aa85ca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUI0OjExMzhGRjoxMTRENjYwOjE3OTU0Njk6NkE0RDZCMEYiLCJ2aXNpdG9yX2lkIjoiMjQ0NjU1MjkzMzEyMzYzMjc5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0e4ec015f7d734df10fcc099495d1b890413d20d9e60835d328680ecaf44b6c5 |
| hovercard-subject-tag | issue:3088308138 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/58443/issue_layout |
| twitter:image | https://opengraph.githubassets.com/db83d487fbfd9f6422927e7e82c4e3e0b73d3f0e44fa52867d33296235597405/nodejs/node/issues/58443 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/db83d487fbfd9f6422927e7e82c4e3e0b73d3f0e44fa52867d33296235597405/nodejs/node/issues/58443 |
| og:image:alt | Currently, mock.module's options expects defaultExport and namedExports separately. We are not aware of a reason to separate them, and it's inconsistent with other major testing frameworks/utilitie... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JakobJingleheimer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7db3950e3f59095e20a9789440c3dd554efc62d434882ead06ae05b5815605b9 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cd8f6a71db61d6012a0cbb134be844fdbe9b8a45 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width