New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing a mocked ESM module dynamically will throw an error in node 16.17.0 #498
Comments
I haven't used I would have expected: import * as td from 'testdouble';
const fs = await td.replaceEsm('fs', {}); And then the subject under test would be loaded and it would in turn As a result I'm not sure this is supported. Can you elaborate if it seems like I'm off-base? |
Perhaps the minimum repro is too minimum in this case. The same thing happens if the dynamic import occurs further down the dependency tree: import * as td from 'testdouble';
await td.replaceEsm('fs', {});
await import('./test-module.js');
await import('fs'); In this situation it doesn't make sense to use the return value of |
The bug actually came from usage of my fork, not qubbile mainline. Sorry about that. This was fixed by testdouble/quibble#74 – simply rebasing the latest code fixed it for us. |
Description
Importing a mocked ESM module dynamically will throw an error in node 16.17.0 but not 16.16.0.
Issue
Mocking an esm module will result on an error
Environment
node -v
output: v16.17.0yarn --version
output: 1.22.19yarn list testdouble
version: testdouble@3.16.5Code-fenced Examples
The text was updated successfully, but these errors were encountered: