MCPcopy
hub / github.com/google/tamperchrome / snap

Method snap

v2/ui/e2e/src/app.po.ts:66–78  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

64 }
65
66 async snap(name: string) {
67 if (!name.match(/^[a-z0-9-]+$/i)) {throw new Error('name must be alphanum.');}
68 const path = `${__dirname}/goldens`;
69 const snap = await this.takeSnapshot();
70 const proc = spawnSync('diff', ['-N', name, '-'], {
71 cwd: path, input: snap, encoding: 'UTF-8'});
72 const diff = proc.stdout;
73 writeFileSync(`${path}/${name}.patch`, diff);
74 if (diff) {
75 this.diffs.push({name, diff});
76 }
77 return diff;
78 }
79
80 getDiffs() {
81 return this.diffs.slice();

Callers 1

app.e2e-spec.tsFile · 0.80

Calls 1

takeSnapshotMethod · 0.95

Tested by

no test coverage detected