snapshot.setDefaultSnapshotSerializers(serializers)
serializers<Array> 用作快照测试的默认序列化器的一组同步函数。
此函数用于自定义测试运行程序使用的默认序列化机制。默认情况下,测试运行程序通过对提供的值调用 JSON.stringify(value, null, 2) 来执行序列化。JSON.stringify() 在循环结构和支持的数据类型方面确实存在限制。如果需要更强大的序列化机制,应使用此函数。
【This function is used to customize the default serialization mechanism used by
the test runner. By default, the test runner performs serialization by calling
JSON.stringify(value, null, 2) on the provided value. JSON.stringify() does
have limitations regarding circular structures and supported data types. If a
more robust serialization mechanism is required, this function should be used.】