snapshot.setResolveSnapshotPath(fn)


  • fn <Function> 一个用于计算快照文件位置的函数。该函数以测试文件的路径作为其唯一参数。如果测试没有关联文件(例如在 REPL 中),输入将为 undefined。fn() 必须返回一个字符串,指定快照文件的位置。

此功能用于自定义用于快照测试的快照文件的位置。默认情况下,快照文件名与入口点文件名相同,并使用 .snapshot 文件扩展名。

【This function is used to customize the location of the snapshot file used for snapshot testing. By default, the snapshot filename is the same as the entry point filename with a .snapshot file extension.】