@lewiswright/vitest-plugin-vis
Version:
Vitest visual testing plugin
14 lines (13 loc) • 414 B
JavaScript
import { ctx } from "./ctx.js";
import { extractAutoSnapshotOptions } from "./snapshot_options.js";
/**
* Determine should snapshot be taken.
*
* not story: false
* no `snapshot` tag: false
* disabled by `!snapshot` tag: false
*/
export function shouldTakeSnapshot(meta) {
const m = meta ?? extractAutoSnapshotOptions(ctx.getCurrentTest());
return document.body.childElementCount > 0 && m?.enable;
}