UNPKG

@web/test-runner-visual-regression

Version:
36 lines 1.42 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultOptions = void 0; const path_1 = __importDefault(require("path")); const mkdirp_1 = __importDefault(require("mkdirp")); const fs_js_1 = require("./fs.js"); const pixelMatchDiff_js_1 = require("./pixelMatchDiff.js"); async function getImage({ filePath }) { if (await (0, fs_js_1.fileExists)(filePath)) { return (0, fs_js_1.readFile)(filePath); } } async function saveImage({ filePath, content }) { await (0, mkdirp_1.default)(path_1.default.dirname(filePath)); await (0, fs_js_1.writeFile)(filePath, content); } exports.defaultOptions = { update: false, buildCache: false, baseDir: 'screenshots', diffOptions: {}, failureThreshold: 0, failureThresholdType: 'percent', getBaselineName: ({ browser, name }) => path_1.default.join(browser, 'baseline', name), getDiffName: ({ browser, name }) => path_1.default.join(browser, 'failed', `${name}-diff`), getFailedName: ({ browser, name }) => path_1.default.join(browser, 'failed', name), getBaseline: getImage, saveBaseline: saveImage, saveDiff: saveImage, saveFailed: saveImage, getImageDiff: pixelMatchDiff_js_1.pixelMatchDiff, }; //# sourceMappingURL=config.js.map