avajs/ava

Allow further customization of where snapshots are stored

Open

#2,921 创建于 2021年12月31日

在 GitHub 查看
 (2 评论) (1 反应) (0 负责人)JavaScript (1,408 fork)batch import
enhancementhelp wantedscope:snapshot-management

仓库指标

Star
 (20,600 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Per discussion, in an ava.config.js:

export default {
  snapshotDir (testFile) {
    return new URL('.', testFile)
  }
}

Up till now snapshotDir is a fixed directory under which snapshot files are stored, with subdirectories that match the relative location of the corresponding test files. My suggestion is we make it a function which receives a file URL string (like import.meta.url) and returns a file URL instance that points at the directory within which the snapshots should be stored. The above example would store them alongside the test files.

The main process will have to run this function before it spins up the test worker thread and pass the resulting directory to the runner.

贡献者指南