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 209ad71
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 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,7 +33,11 @@ export const compare = async (config: Config): Promise<CompareOutput> =>
enableAntialias: config.enableAntialias,
});

emitter.on('complete', async result => {
if (config.reportFilePath) {
await cpy(workspace(), config.reportFilePath);
}

emitter.on('complete', result => {
log.debug('compare result', result);
log.info('Comparison Complete');
log.info(chalk.red(' Changed items: ' + result.failedItems.length));
Expand Down

0 comments on commit 209ad71

Please sign in to comment.