-
Notifications
You must be signed in to change notification settings - Fork 19
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
yarn pnp issues #241
Comments
I will be able to take a look soon edit reproduction repo is here: https://github.com/koshic/esmock-testing |
@koshic if you have bandwidth, would you add a failing test in a PR? ideally, the test would be added to the bottom of tests/tests-node/esmock.node.test.js We could merge the failed-test PR right away and I could resolve the scope issue myself in a different branch. |
Sorry I missed this not much sleep here. I'll add a test. |
@iambumblehead sure, but tomorrow by Moscow time ) I was hoping to be free today, but... |
@koshic no rush take your time :) https://www.youtube.com/watch?v=Lqg8_gpUm5A |
I'm here and will try to provide broken test / review other PRs |
@iambumblehead at first - thank you for creating branch and PR! My local example is very similar. BTW, tests failed (github codespace, the same result on my local machine with node 20.6.1) after 'npm test': |
esmock does not support npm workspaces as mentioned in the other issue #235 (comment) Could that be the issue? That message is thrown when esmock cannot locate the moduleId, for example if the moduleId is found in a workspace esmock's resolver cannot lookup. const errModuleIdNotFound = (moduleId, parent) =>
new Error(`invalid moduleId: "${moduleId}" (used by ${parent})`)
// ...
const moduleFileURL = resolvewith(moduleId, parent)
if (!moduleFileURL)
throw esmockErr.errModuleIdNotFound(moduleId, parent) Maybe try the suggestion from tpluscode added to the wiki https://github.com/iambumblehead/esmock/wiki#call-esmock-npm-workspaces Maybe support for workspaces should be added to the resolver. |
Yeah , thx for that workaround - root cause is switching from import.meta.resolve to resolvewithplus, which is also doesn't support Yarn PnP. |
@koshic I am trying to reproduce the "invalid moduleId" error, in order to update esmock so that workarounds will not be needed. Please give advice, if you know how the error could be reproduced. Current tests which do not show the invalid moduleId error are here |
based on some investigation and on this discussion here wooorm/import-meta-resolve#10 I am going to re-close this issue |
if yarn pnp's module-resolving were refined to an npm package, other packages like esmock could use that to support pnp resolution. oh well, such a package does not exist. |
Other scoped modules can't be mocked too. Wrong regexp?
Haven't enough time to provide unit test right now (
The text was updated successfully, but these errors were encountered: