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
![Screenshot 2024-05-06 at 13 09 54](https://private-user-images.githubusercontent.com/30977845/328243457-1a6ceeca-5a57-4bcb-82b5-28c765e18b85.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMDY5NTQsIm5iZiI6MTczOTMwNjY1NCwicGF0aCI6Ii8zMDk3Nzg0NS8zMjgyNDM0NTctMWE2Y2VlY2EtNWE1Ny00YmNiLTgyYjUtMjhjNzY1ZTE4Yjg1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDIwNDQxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZiMmNjOTk4OTJkMjc4MzAxYTg4MDU2ODllNTEzYmJjZTYyNGY2M2JlODE1NzU4OTgyYTZjZWFmYmVmYTlhYzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.UkdhPA5kcvK1FmWnCxUgyJRrFRfw2PqR3ZCAdI4q9Pc)
1.6.0
( not even half of the full error ):After
![Screenshot 2024-05-06 at 13 10 45](https://private-user-images.githubusercontent.com/30977845/328243695-c9551c7f-9fc8-471c-9530-d12900791b58.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMDY5NTQsIm5iZiI6MTczOTMwNjY1NCwicGF0aCI6Ii8zMDk3Nzg0NS8zMjgyNDM2OTUtYzk1NTFjN2YtOWZjOC00NzFjLTk1MzAtZDEyOTAwNzkxYjU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDIwNDQxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMxZDExYzRlN2YwNGM3M2E0YTc1YWZiMmJhNDM4YzYwNmRlYzk1MmRhNGQ0NWY5OGM5ODgzMWQxYjZiMDI5NzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ApJOrEzLQlgoNStNCUgLREMpQgq0bNV_NFhC2CVQ7Pc)
1.6.0
( whole error ):The text was updated successfully, but these errors were encountered: