UNPKG

@applitools/eyes

Version:
57 lines (56 loc) 2.18 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); /* eslint no-console: off */ const offline_1 = require("@applitools/core/offline"); const yargs_1 = __importDefault(require("yargs")); const Configuration_1 = require("../input/Configuration"); const load_config_1 = require("./load-config"); void yargs_1.default .example([['eyes run-offline-snapshots', 'Run Eyes visual tests on existing snapshots']]) .command({ command: 'run-offline-snapshots', builder: yargs => { return yargs .options({ offlineLocationPath: { description: 'path to offline snapshots folder', type: 'string', }, failOnDiff: { description: 'should exit process with non-zero exit code on visual diffs, thereby failing the CI job', type: 'boolean', default: false, }, failOnError: { description: 'should exit process with non-zero exit code on errors, thereby failing the CI job', type: 'boolean', default: true, }, configPath: { description: 'path to configuration file (applitools.config.js / applitools.config.ts)', type: 'string', }, jsonFilePath: { description: 'path to json file with the test results', type: 'string', }, }) .fail((_msg, err, _yargs) => { if (err) { console.error(err.message); // console.log(err) process.exit(1); } }); }, handler: async (args) => { const config = await (0, load_config_1.loadConfig)(args.configPath); const options = { ...args, config: new Configuration_1.ConfigurationData(config).toJSON() }; await (0, offline_1.runOfflineSnapshots)(options); }, }) .wrap(yargs_1.default.terminalWidth()).argv;