Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return value;
}
const size = value.split('x');
return {
width: parseInt(size[0], 10),
height: parseInt(size[1], 10)
};
}
}),
sessionsPerBrowser: positiveIntegerOption(defaultFactory('sessionsPerBrowser')),
suitesPerSession: positiveIntegerOption(defaultFactory('suitesPerSession')),
retry: option({
defaultValue: defaultFactory('retry'),
parseEnv: Number,
parseCli: Number,
validate: (value) => {
is('number')(value);
if (value < 0) {
throw new GeminiError('"retry" must be non-negative');
}
}
}),
screenshotMode: option({
defaultValue: defaultFactory('screenshotMode'),
validate: (value) => {
is('string')(value);
if (!_.includes(['fullpage', 'viewport', 'auto'], value)) {
defaultValue: defaultFactory('rootUrl'),
map: (value, config) => {
return config.rootUrl && !value.match(/^https?:\/\//)
? url.resolve(config.rootUrl, value.replace(/^\//, ''))
: value;
}
}),
gridUrl: option({
validate: is('string'),
defaultValue: defaultFactory('gridUrl')
}),
calibrate: booleanOption(defaultFactory('calibrate')),
httpTimeout: option({
parseEnv: parseTimeout,
parseCli: parseTimeout,
validate: (value) => {
if (value === 'default') {
return;
}
assertNonNegative(value, 'httpTimeout');
},
defaultValue: defaultFactory('httpTimeout')
}),
sessionRequestTimeout: option({
parseEnv: Number,
parseCli: Number,
validate: (value) => {
if (_.isNull(value)) {
}),
screenshotsDir: option({
validate: is('string'),
defaultValue: defaultFactory('screenshotsDir'),
map: resolveWithProjectRoot
}),
tolerance: option({
defaultValue: defaultFactory('tolerance'),
parseEnv: Number,
parseCli: Number,
validate: is('number')
}),
antialiasingTolerance: option({
defaultValue: defaultFactory('antialiasingTolerance'),
parseEnv: Number,
parseCli: Number,
validate: is('number')
}),
windowSize: option({
defaultValue: defaultFactory('windowSize'),
validate: (value) => {
if (_.isObject(value) && _.isNumber(value.width) && _.isNumber(value.height)) {
return;
} else if (value === null) {
//null is valid value for this option, skip any other checks
return;
} else if (!_.isString(value)) {
throw new GeminiError('"windowSize" must be string or null');
sessionsPerBrowser: positiveIntegerOption(defaultFactory('sessionsPerBrowser')),
suitesPerSession: positiveIntegerOption(defaultFactory('suitesPerSession')),
retry: option({
defaultValue: defaultFactory('retry'),
parseEnv: Number,
parseCli: Number,
validate: (value) => {
is('number')(value);
if (value < 0) {
throw new GeminiError('"retry" must be non-negative');
}
}
}),
screenshotMode: option({
defaultValue: defaultFactory('screenshotMode'),
validate: (value) => {
is('string')(value);
if (!_.includes(['fullpage', 'viewport', 'auto'], value)) {
throw new GeminiError('"screenshotMode" must be one of "fullpage", "viewport" or "auto"');
}
}
}),
screenshotDelay: option({
defaultValue: defaultFactory('screenshotDelay'),
parseEnv: Number,
parseCli: Number,
validate: (value) => {
assertNonNegative(value, 'screenshotDelay');
}
defaultValue: defaultFactory('sessionRequestTimeout')
}),
sessionQuitTimeout: option({
parseEnv: Number,
parseCli: Number,
validate: (value) => {
if (_.isNull(value)) {
return;
}
assertNonNegative(value, 'sessionQuitTimeout');
},
defaultValue: defaultFactory('sessionQuitTimeout')
}),
screenshotsDir: option({
validate: is('string'),
defaultValue: defaultFactory('screenshotsDir'),
map: resolveWithProjectRoot
}),
tolerance: option({
defaultValue: defaultFactory('tolerance'),
parseEnv: Number,
parseCli: Number,
validate: is('number')
}),
antialiasingTolerance: option({
defaultValue: defaultFactory('antialiasingTolerance'),
parseEnv: Number,
parseCli: Number,
if (!_.includes(['fullpage', 'viewport', 'auto'], value)) {
throw new Error('"screenshotMode" must be "fullpage", "viewport" or "auto"');
}
}
}),
screenshotDelay: options.nonNegativeInteger('screenshotDelay'),
tolerance: option({
defaultValue: defaultFactory('tolerance'),
parseEnv: Number,
parseCli: Number,
validate: (value) => utils.assertNonNegativeNumber(value, 'tolerance')
}),
antialiasingTolerance: option({
defaultValue: defaultFactory('antialiasingTolerance'),
parseEnv: Number,
parseCli: Number,
validate: (value) => utils.assertNonNegativeNumber(value, 'antialiasingTolerance')
}),
compareOpts: options.optionalObject('compareOpts'),
buildDiffOpts: options.optionalObject('buildDiffOpts'),
meta: options.optionalObject('meta'),
windowSize: option({
defaultValue: defaultFactory('windowSize'),
validate: (value) => {
if (_.isNull(value)) {
function buildBrowserOptions(defaultFactory, extra) {
return _.extend(extra, {
rootUrl: option({
validate: is('string'),
defaultValue: defaultFactory('rootUrl'),
map: (value, config) => {
return config.rootUrl && !value.match(/^https?:\/\//)
? url.resolve(config.rootUrl, value.replace(/^\//, ''))
: value;
}
}),
gridUrl: option({
validate: is('string'),
defaultValue: defaultFactory('gridUrl')
}),
calibrate: booleanOption(defaultFactory('calibrate')),
httpTimeout: option({
parseEnv: parseTimeout,
parseCli: parseTimeout,
validate: (value) => {
if (value === 'default') {
return;
}
assertNonNegative(value, 'httpTimeout');
},
defaultValue: defaultFactory('httpTimeout')
function buildBrowserOptions(defaultFactory, extra) {
return _.extend(extra, {
rootUrl: option({
validate: is('string'),
defaultValue: defaultFactory('rootUrl'),
map: (value, config) => {
return config.rootUrl && !value.match(/^https?:\/\//)
? url.resolve(config.rootUrl, value.replace(/^\//, ''))
: value;
}
}),
gridUrl: option({
validate: is('string'),
defaultValue: defaultFactory('gridUrl')
}),
calibrate: booleanOption(defaultFactory('calibrate')),
}
}
}),
buildDiffOpts: option({
defaultValue: defaultFactory('buildDiffOpts'),
parseEnv: JSON.parse,
parseCli: JSON.parse,
validate: (value) => {
if (!isOptionalObject(value)) {
throw new GeminiError('buildDiffOpts should be object');
}
}
}),
orientation: option({
defaultValue: defaultFactory('orientation'),
validate: (value) => {
if (_.isNull(value)) {
return;
}
is('string', 'orientation')(value);
if (value !== 'landscape' && value !== 'portrait') {
throw new Error('"orientation" must be "landscape" or "portrait"');
}
}
})
});
}
defaultValue: defaultFactory('screenshotPath'),
validate: (value) => _.isNull(value) || is('string', 'screenshotPath')(value),
map: utils.resolveWithProjectDir
}),
screenshotsDir: options.stringOrFunction('screenshotsDir'),
calibrate: options.boolean('calibrate'),
compositeImage: options.boolean('compositeImage'),
w3cCompatible: options.boolean('w3cCompatible'),
strictTestsOrder: options.boolean('strictTestsOrder'),
screenshotMode: option({
defaultValue: defaultFactory('screenshotMode'),
validate: (value) => {
is('string', 'screenshotMode')(value);
if (!_.includes(['fullpage', 'viewport', 'auto'], value)) {
throw new Error('"screenshotMode" must be "fullpage", "viewport" or "auto"');
}
}
}),
screenshotDelay: options.nonNegativeInteger('screenshotDelay'),
tolerance: option({
defaultValue: defaultFactory('tolerance'),
parseEnv: Number,
parseCli: Number,