Upgrade Vitest
to 1.6.0
To Reduce Serialized Error Payload Length
#2246
Labels
chore
Issue is a chore
Vitest
to 1.6.0
To Reduce Serialized Error Payload Length
#2246
When Vitest encounters a class instance within an Error object during serialization, it attempts to serialize the instance's properties and methods. For example, if it finds a
BN
instance, instead of merely serializing straightforward properties like:It would serialize the entire structure, including methods and potentially inherited properties, resulting in a detailed and extensive output like:
This issue arises because Vitest does not automatically invoke the
toJSON
method on custom Error implementations, instead opting to manually serialize every attribute it encounters within the instances/objects.However, this is fixed on 1.6.0
Before
1.6.0
( not even half of the full error ):After
1.6.0
( whole error ):The text was updated successfully, but these errors were encountered: