Repository navigation
feat: separate local/global import mocks - #360
Conversation
|
is this PR complete? If so, one question I have is about the line that looks like this // distinguishes global mocks from local mocks of the same specifier
scope === 'global' ? 'esmkScope=g' : ''does it alter the behaviour in any way or is it there for debugging things and looking at the url? |
|
the test passes with surprisingly few changes, imo. nice PR |
|
I cloned it and removed this |
|
It looks good to me |
|
coverage shows 100% after removing the uncovered line |
|
The global scope line is to differentiate between the two Lines 121 to 122 in dd12eda Otherwise they'd overlap on an individual module's replacement string. (Admittedly I had originally tried to use a separate key for |
|
imo this was a tricky PR thank you for resolving this and in such a way that it appears effortless/easy. I'll publish soonish after getting an auth key from npm |
Closes #355
Adds support for having separate global-level
importmocks ondefsandgdefs:esmock/tests/tests-node/esmock.node.global.test.js
Lines 45 to 58 in a012cc8
If both are set, the mocks in
gdefsare merged with the ones indefs, with the latter taking precedent.