Open theKashey opened 5 years ago
@theKashey any update on this? I am working on a project that has "type": "module"
and it does not work for me.
As you mentioned, import rewiremock from 'rewiremock';
is not working. I tried rewiremock/node
and it does not throw the error at startup, but modules are not mocked
Stumbled upon this while trying to integrate local mocking of dependencies in AVA. AVA 4 requires the use of "type": "module"
when testing typescript files and rewiremock really seems to dislike that. With the current setup I have control over the ts-node loader. Is there something I could add into the loader that would make rewiremock resolve the parent-child problem?
I saw https://github.com/theKashey/rewiremock/issues/24 where quibble basically solves the problem through the loader but relies on a bit of a hacky global communication and only supports global mocking.
Seems however that based on https://github.com/theKashey/rewiremock/issues/132 it is not possible to dismiss esm anymore as more packages adopt it.
[x] works with
esm
package - #24.module
ormockery
format..mjs
files[ ] works with native node 12 modules
module.parent
is defined (attranslators / 'commonjs'
)