All files config.js

64.29% Statements 9/14
33.33% Branches 2/6
100% Functions 0/0
64.29% Lines 9/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34                    1x   1x   1x 1x   1x   1x 1x     1x                 1x  
"use strict";
/**
 * Configures `Xvfb` plugin. Extends `GlaceJS` configuration.
 *
 * @namespace GlaceConfig
 * @prop {object} xvfb - `Xvfb` options.
 * @prop {?number} [xvfb.width] - `Xvfb` display width.
 * @prop {?number} [xvfb.height] - `Xvfb` display height.
 */
 
var expect = require("chai").expect;
 
var U = require("glace-utils");
 
var config = U.config;
var args = config.args;
 
config.xvfb = U.defVal(config.xvfb, {});
 
config.xvfb.use = U.defVal(args.xvfb, false);
Iif (typeof(args.xvfb) === "number") {
    args.xvfb = String(args.xvfb);
};
Iif (typeof(args.xvfb) === "string") {
    var [ width, height ] = args.xvfb.split("x");
    expect(width && height,
        "Invalid 'xvfb' options. Use variants " +
        "'--xvfb' or '--xvfb <width>x<height>'").to.exist;
    config.xvfb.width = width;
    config.xvfb.height = height;
};
 
module.exports = config;