forked from OasisDEX/eth2dai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodechecks.ts
More file actions
28 lines (23 loc) · 1.12 KB
/
codechecks.ts
File metadata and controls
28 lines (23 loc) · 1.12 KB
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
28
import { codechecks } from '@codechecks/client';
import { join } from 'path';
// tslint:disable-next-line
const exec = require('await-exec') as (cmd: string, opt: any) => Promise<void>;
export async function main() {
await visReg();
}
async function visReg() {
const execOptions = { timeout: 300000, cwd: process.cwd(), log: true };
await exec('yarn storybook:screenshots', execOptions);
await codechecks.saveCollection('storybook-vis-reg', join(__dirname, '__screenshots__'));
if (codechecks.isPr()) {
await codechecks.getCollection('storybook-vis-reg', join(__dirname, '.reg/expected'));
await exec('./node_modules/.bin/reg-suit compare', execOptions);
await codechecks.saveCollection('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'),
});
}
}