Skip to content

Commit

Permalink
fix: report generation
Browse files Browse the repository at this point in the history
  • Loading branch information
bokuweb committed Mar 23, 2024
1 parent c2e769a commit 8b1aaca
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Config } from './config';
import * as constants from './constants';
import { workspace } from './path';
import path from 'path/posix';
import cpy from 'cpy';

const _compare = require('reg-cli');

Expand All @@ -16,13 +17,13 @@ export type CompareOutput = {
};

export const compare = async (config: Config): Promise<CompareOutput> =>
new Promise<CompareOutput>(resolve => {
new Promise<CompareOutput>(async resolve => {
const emitter = _compare({
actualDir: path.join(workspace(), constants.ACTUAL_DIR_NAME),
expectedDir: path.join(workspace(), constants.EXPECTED_DIR_NAME),
diffDir: path.join(workspace(), constants.DIFF_DIR_NAME),
json: path.join(workspace(), constants.JSON_NAME),
report: config.reportFilePath,
report: path.join(workspace(), './report.html'),
update: false,
ignoreChange: true,
urlPrefix: '',
Expand All @@ -32,6 +33,10 @@ export const compare = async (config: Config): Promise<CompareOutput> =>
enableAntialias: config.enableAntialias,
});

if (config.reportFilePath) {
await cpy(workspace(), config.reportFilePath);
}

emitter.on('complete', async result => {
log.debug('compare result', result);
log.info('Comparison Complete');
Expand Down

0 comments on commit 8b1aaca

Please sign in to comment.