testdouble.js
testdouble.js copied to clipboard
td.replace CJS module-replacement gives bad message if item is not requireable
I had a depended-on module X that was in a not-requireable state because of a typo in one of its import statements. The symptom given to me by TD when I tried to td.replace() said module from its user's test was "module X not found".
This was not a useful message, because it sent me on a hunt to find a ../../ path screw-up, when the real root cause was that quibble failed to require it, so it just blew up. It's necessary for dependencies' to require cleanly so we can imitate their functions/constructors/etc, but the message should indicate that's what failed, not that the file was missing.