fix: Determining inheritedMetadatas
during jest+ts-jest tests collects metadatas that do not belong to the target
#1810
Labels
status: invalid / expired
Issues with no action to take.
type: fix
Issues describing a broken feature.
Description
This is a very edge-casey situation that I ran into.
I have a web service project in typescript@4.9.3 on Node 16 with typeorm@0.2.32 classes being decorated. Everything runs perfectly in normal mode:
tsc
transpiles stuff andnode
runs it without issues. The validator collects the metadata properly.But, when running tests with
jest
that usests-jest
as the transformer (with default configuration), the transpiled output acts kinda weird.For all decorated classes, in
src/metadata/MetadataStorage.ts:109
, when computinginheritedMetadatas
, there's anif
:Now, during tests,
metadata.target instanceof Function
yieldsfalse
even though it is the class andtypeof metadata.target
does indeed yield'function'
. I have no idea how this is happening. I'm able to monkey-patch it by usingtypeof
.This used to work with older versions of my dependencies, but I wasn't able to pinpoint the culprit.
The text was updated successfully, but these errors were encountered: