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
Notably, our entrypoint is dist/index.js, which is the transpiled form of src/index.ts.
I believe (but have not yet tested) that this would work correctly when our module is actually required externally. However, there is no way for us to unit test that this behavior is working correctly, as either
the module.register doesn't get run, and thus the subsequent .get() returns undefined
the module.register does get run (by importing our module rather than the file under test), but breaks, because it is making assumptions about there being an index.js in the root directory
For now, I'm just adding a null check to where we search for optional dependencies, and avoiding unit testing this behavior. Having looked at the code, I'm not even sure how you WOULD resolve this. I thought I'd throw it out there in case you had any better ideas.
The text was updated successfully, but these errors were encountered:
Hello!
Similar to #5, this module isn't handling transpiled modules cleanly, specifically when consuming them from unit tests.
Our directory structure is (more or less) as follows:
which is typescript code that gets transpiled to the
dist
directory.and our package.json contains:
Notably, our entrypoint is
dist/index.js
, which is the transpiled form ofsrc/index.ts
.I believe (but have not yet tested) that this would work correctly when our module is actually required externally. However, there is no way for us to unit test that this behavior is working correctly, as either
.get()
returns undefinedFor now, I'm just adding a null check to where we search for optional dependencies, and avoiding unit testing this behavior. Having looked at the code, I'm not even sure how you WOULD resolve this. I thought I'd throw it out there in case you had any better ideas.
The text was updated successfully, but these errors were encountered: