-
Notifications
You must be signed in to change notification settings - Fork 828
Description
Description
This is a very edge-casey situation that I ran into.
I have a web service project in [email protected] on Node 16 with [email protected] classes being decorated. Everything runs perfectly in normal mode: tsc
transpiles stuff and node
runs it without issues. The validator collects the metadata properly.
But, when running tests with jest
that uses ts-jest
as the transformer (with default configuration), the transpiled output acts kinda weird.
For all decorated classes, in src/metadata/MetadataStorage.ts:109
, when computing inheritedMetadatas
, there's an if
:
if (metadata.target instanceof Function && !(targetConstructor.prototype instanceof metadata.target))
return false;
Now, during tests, metadata.target instanceof Function
yields false
even though it is the class and typeof metadata.target
does indeed yield 'function'
. I have no idea how this is happening. I'm able to monkey-patch it by using typeof
.
This used to work with older versions of my dependencies, but I wasn't able to pinpoint the culprit.