Add support for running a subset of rendering tests

This commit is contained in:
Tim Schaub
2018-11-11 14:18:20 -06:00
parent dc05f48294
commit a9b2952be4

View File

@@ -275,9 +275,13 @@ async function getOutdated(entries, options) {
}
async function main(entries, options) {
if (!options.force) {
if (!options.force && !options.match) {
entries = await getOutdated(entries, options);
}
if (options.match) {
const exp = new RegExp(options.match);
entries = entries.filter(entry => exp.test(entry));
}
if (!options.interactive && entries.length === 0) {
return;
}
@@ -308,10 +312,9 @@ if (require.main === module) {
type: 'number',
default: 3000
}).
option('timeout', {
describe: 'The timeout for loading pages (in milliseconds)',
type: 'number',
default: 60000
option('match', {
describe: 'Only run tests matching the provided string RegExp pattern',
type: 'string'
}).
option('force', {
describe: 'Run all tests (instead of just outdated tests)',
@@ -328,6 +331,11 @@ if (require.main === module) {
choices: ['trace', 'debug', 'info', 'warn', 'error', 'silent'],
default: 'error'
}).
option('timeout', {
describe: 'The timeout for loading pages (in milliseconds)',
type: 'number',
default: 60000
}).
option('headless', {
describe: 'Launch Puppeteer in headless mode',
type: 'boolean',