forked from aruzikulov/platform-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodechecks-vis-reg.ts
27 lines (21 loc) · 1.02 KB
/
codechecks-vis-reg.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { codechecks } from "@codechecks/client";
import * as exec from "await-exec";
import { join } from "path";
export async function main(): Promise<void> {
await visReg();
}
async function visReg(): Promise<void> {
await codechecks.saveDirectory("storybook-vis-reg", join(__dirname, "__screenshots__"));
if (codechecks.isPr()) {
await codechecks.getDirectory("storybook-vis-reg", join(__dirname, ".reg/expected"));
const execOptions = { timeout: 300000, cwd: process.cwd(), log: true };
await exec("./node_modules/.bin/reg-suit compare", execOptions);
await codechecks.saveDirectory("storybook-vis-reg-report", join(__dirname, ".reg"));
const reportData = require("./.reg/out.json");
await codechecks.success({
name: "Visual regression for Storybook",
shortDescription: `Changed: ${reportData.failedItems.length}, New: ${reportData.newItems.length}, Deleted: ${reportData.deletedItems.length}`,
detailsUrl: codechecks.getArtifactLink("/storybook-vis-reg-report/index.html"),
});
}
}