@applitools/eyes-storybook
Version:
115 lines (106 loc) • 3.27 kB
JavaScript
module.exports = {
conf: {
alias: 'f',
description: 'Path to applitools.config.js config file',
requiresArg: true,
string: true,
},
storybookUrl: {
alias: ['storybook-url', 'u'],
description: 'URL to storybook',
requiresArg: true,
string: true,
},
// storybook options
storybookPort: {
alias: ['storybook-port', 'p'],
description: 'Port to run Storybook',
requiresArg: false,
number: true,
},
storybookHost: {
alias: ['storybook-host', 'h'],
description: 'Host to run Storybook',
requiresArg: false,
string: true,
},
storybookConfigDir: {
alias: ['storybook-config-dir', 'c'],
description: "Path to Storybook's config folder (defaults to .storybook)",
requiresArg: true,
string: true,
},
storybookStaticDir: {
alias: ['storybook-static-dir', 's'],
description: "Path to Storybook's static files folder",
requiresArg: true,
string: true,
},
showStorybookOutput: {
alias: ['show-storybook-output'],
description: 'whether or not you want to see Storybook output',
boolean: true,
},
readStoriesTimeout: {
alias: ['read-stories-timeout'],
description: 'The time to wait until all stories are read, before starting the visual tests',
number: true,
},
include: {
description:
'A string that represents a story title or a regex (starts and ends with /) to match stories title',
requiresArg: false,
string: true,
coerce: function (arg) {
if (arg.startsWith('/') && arg.endsWith('/')) {
// create a regex and remove slashes from the start and end of the input
return new RegExp(arg.substring(1, arg.length - 1));
} else return arg;
},
},
networkBlockPatterns: {
alias: ['network-block-patterns'],
description: 'Patterns to block from network requests',
requiresArg: false,
array: true,
},
browserCacheRequests: {
alias: ['browser-cache-requests'],
description: 'Intercept and cache requests coming from the browser',
requiresArg: false,
boolean: true,
},
navigationWaitUntil: {
alias: ['navigation-wait-until'],
description: 'When to consider navigation to be finished',
requiresArg: false,
choices: ['load', 'domcontentloaded', 'networkidle0', 'networkidle2'], // PuppeteerLifeCycleEvent values - https://pptr.dev/api/puppeteer.puppeteerlifecycleevent
},
shard: {
description: 'Shard tests (format: current/total, e.g., "1/3")',
requiresArg: true,
string: true,
coerce: function (arg) {
const match = arg.match(/^(\d+)\/(\d+)$/);
if (!match) {
throw new Error('shard must be in format "current/total" (e.g., "1/3")');
}
const current = parseInt(match[1], 10);
const total = parseInt(match[2], 10);
if (current < 1 || current > total) {
throw new Error(`shard current (${current}) must be between 1 and total (${total})`);
}
if (total < 1) {
throw new Error(`shard total (${total}) must be at least 1`);
}
return {current, total};
},
},
// general
exitcode: {
alias: 'e',
description: 'If tests failed close with non-zero exit code',
requiresArg: false,
boolean: true,
},
};