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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 1x 1x 1x 1x 1x 22x 22x 22x 22x 22x 22x 22x 22x 1x | "use strict"; /** * `Glace video` globals. * * @module */ const _ = require("lodash"); const U = require("glace-utils"); const CONF = require("./config"); const gScope = global.scope; /** * Extends `scope` function by addition options to manage video recording. * Cause it overrides `scope`, all functions, which use global `scope` inside, * can pass its options as well. * * @global * @function scope * @arg {string} name - Scope name. * @arg {function[]} [fixtures] - List of fixtures. * @arg {object} [opts] - Options, which extends basic options. * @arg {string} [opts.videoName] - Name of video file. * @arg {string} [opts.videoDir] - Folder to save video file. * @arg {boolean} [opts.videoSave] - Flag to save video even if all is passed inside. * @arg {boolean} [opts.video] - Flag to capture video with default options. * Used if above options are missed. * @arg {function} func - Callback with tests or chunks. */ const _scope = (name, fixtures, opts, func) => { if (_.isFunction(opts)) [func, opts] = [opts]; Iif (_.isPlainObject(fixtures)) [opts, fixtures] = [fixtures]; if (_.isFunction(fixtures)) [func, fixtures] = [fixtures]; fixtures = fixtures || []; opts = opts || {}; const video = !!U.defVal( opts.video, opts.videoName, opts.videoDir, opts.videoSave, false); Iif (video || CONF.video.capture) { if (!fixtures.includes(fxVideo)) { fixtures = [fxVideoFunc({ name: opts.videoName, dir: opts.videoDir, save: opts.videoSave, })].concat(fixtures); } } gScope(name, fixtures, opts, func); }; global.scope = _scope; |