snapshot.setResolveSnapshotPath(fn)
-
fn
<Function> 用于计算快照文件位置的函数。该函数接收测试文件的路径作为其唯一参数。如果测试与文件无关(例如在 REPL 中),则输入未定义。fn()
必须返回一个字符串,指定快照文件的位置。¥
fn
<Function> A function used to compute the location of the snapshot file. The function receives the path of the test file as its only argument. If the test is not associated with a file (for example in the REPL), the input is undefined.fn()
must return a string specifying the location of the snapshot snapshot file.
此函数用于自定义用于快照测试的快照文件的位置。默认情况下,快照文件名与入口点文件名相同,但文件扩展名为 .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.