ESM import and globals mocking for unit tests
add node 22 to ci test pipeline and use with { type: 'json' }
import syntax for node >= 20,
with { type: 'json' }
for node 22Essentially, this release enables esmock to resolve the following esm export, see https://github.com/iambumblehead/esmock/issues/293
{
"exports": {
"./*": {
"require": "./*.js",
"import": "./*.js"
}
}
}
the following is added to the README,
Note: Typescript loaders ts-node
👍 and tsm
👍 are compatible with other loaders, including esmock. swc
👎 and tsx
👎 are demonstrated as incompatible with other loaders, including esmock.
Full list of changes,
resolve nested exports defined on named-properties with wildcards, eg exports: { './*': { default: './src/*/index.js' } }
resolves this issue at esmock thanks @dschnare
remove reserved keywords from export names lists, allows express to be mocked, thanks @lcapel
mostly this release resolves an issue mocking builtins imported globally with await import
await import
thanks @btakitatypings: make MockFunction generic, thanks @uwinkelvos
catch yarn PnP exception @koshic
mainly this issue resolves a critical error reported here https://github.com/iambumblehead/esmock/issues/260
update resolver to latest version, resolves a resolution error that seems to have been introduced by a previous update from the past week.