How to use gemini-configparser - 10 common examples

To help you get started, we’ve selected a few gemini-configparser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gemini-testing / gemini / lib / config / browser-options.js View on Github external
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)) {
github gemini-testing / gemini / lib / config / browser-options.js View on Github external
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)) {
github gemini-testing / gemini / lib / config / browser-options.js View on Github external
}),

        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');
github gemini-testing / gemini / lib / config / browser-options.js View on Github external
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');
            }
github gemini-testing / gemini / lib / config / browser-options.js View on Github external
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,
github gemini-testing / hermione / lib / config / browser-options.js View on Github external
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)) {
github gemini-testing / gemini / lib / config / browser-options.js View on Github external
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')
github gemini-testing / gemini / lib / config / browser-options.js View on Github external
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')),
github gemini-testing / gemini / lib / config / browser-options.js View on Github external
}
            }
        }),

        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"');
                }
            }
        })
    });
}
github gemini-testing / hermione / lib / config / browser-options.js View on Github external
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,

gemini-configparser

Config parser module for gemini

MIT
Latest version published 3 months ago

Package Health Score

63 / 100
Full package analysis

Similar packages