When we use ES6's import/export syntax to share individual functions, but compile to CommonJS, it's not possible to stub or spy on a function that's called by another in the same module.
When using native ES modules, you cannot stub or spy on named imports from any module.
Run npm install
Add the property type
to package.json and set the value to module
then change the npm script test
from npm run test:commonjs
to npm run test:esm
.
Then run npm test
and examine the results.
Remove the type
property from package.json and change the npm script test
from npm run test:esm
to npm run test:commonjs
Then run npm test
and examine the results.