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