Open
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() {…}
function mock__foo() {…}
mock.module('example.mjs', {
- defaultExport: mock__default,
- namedExports: {
+ exports: {
+ default: mock__default,
foo: mock__foo,
},
});
The plan would be:
- Immediately introduce
options.exports
- alias
defaultExport
&namedExports
intooptions.exports
- alias
- Immediately flag
defaultExport
&namedExports
deprecated - Provide a userland-migration to automatically transform old to new
- In node 25.x remove
defaultExport
&namedExports
Metadata
Metadata
Assignees
Type
Projects
Status
Todo