-
I have a project that uses modules. The project codebase builds fine and runs perfectly, but Mocha fails to run tests with this error:
It doesn't matter if I use the alternate method of importing, I still get an error about Ref not being found. This is the only Typegoose piece I have issues with. If I don't use Ref Mocha has no issues testing any of the other code that depends on Typegoose. tsconfig.json has the following set:
package.json has the following set:
.mocharc.jsonc has the following set:
Does anyone know how to resolve this issue? Since the code runs fine outside of Mocha I assume it is some sort of configuration thing I'm missing, but I can't figure out what it might be. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
this issue seems to be that somehow the type using |
Beta Was this translation helpful? Give feedback.
-
Attached zip file has a minimal repo. See the README inside, but basically:
|
Beta Was this translation helpful? Give feedback.
your reproduction repository does not actually contain any tests, so i cannot say any further than the first issue is that you have
ts-node: transpileOnly: true
set, which does no type-checking, which seems to be required for combined type and value importsmaybe somewhat related to TypeStrong/ts-loader#751
workaround without removing that option would be to split type and value imports, like
though this might become annoying to do and check manually (because things like vscode will always try to combine them)