You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
stacktrace: Error: Cannot find module '../../src/wrap/log' from '/Users/justin/code/testdouble/testdouble.js'
at Function.module.exports [as sync] (/Users/justin/code/testdouble/testdouble.js/node_modules/resolve/lib/sync.js:37:15)
at requireAt (/Users/justin/code/testdouble/testdouble.js/node_modules/testdouble/lib/replace/module.js:39:38)
at exports.default (/Users/justin/code/testdouble/testdouble.js/node_modules/testdouble/lib/replace/module.js:11:19)
at exports.default [as replace] (/Users/justin/code/testdouble/testdouble.js/node_modules/testdouble/lib/replace/index.js:9:29)
at undefined.beforeEach (/Users/justin/code/testdouble/testdouble.js/unit/when/ensure-rehearsal.test.js:4:14)
at /Users/justin/code/testdouble/testdouble.js/node_modules/teenytest/lib/plugins/callbackify.js:15:17
at runX (/Users/justin/code/testdouble/testdouble.js/node_modules/teenytest/lib/plugins/wrap.js:22:7)
at Object.userFunction [as wrap] (/Users/justin/code/testdouble/testdouble.js/node_modules/teenytest/plugins/uncaught-exception.js:16:9)
at callable (/Users/justin/code/testdouble/testdouble.js/node_modules/teenytest/lib/plugins/wrap.js:29:24)
at runX (/Users/justin/code/testdouble/testdouble.js/node_modules/teenytest/lib/plugins/wrap.js:22:7) ```
The text was updated successfully, but these errors were encountered:
searls
changed the title
td.replace CJS module-replacement fails if item is not requireable
td.replace CJS module-replacement gives bad message if item is not requireable
Jun 14, 2017
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 totd.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 thatquibble
failed torequire
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.The text was updated successfully, but these errors were encountered: