diff --git a/packages/runner/src/commands/test/test-batch.js b/packages/runner/src/commands/test/test-batch.js index 1dad120b..1d55cbbf 100644 --- a/packages/runner/src/commands/test/test-batch.js +++ b/packages/runner/src/commands/test/test-batch.js @@ -34,31 +34,42 @@ function testBatch(target, batch, options, tolerance) { .catch((error) => resolvers.forEach(([, reject]) => reject(error))); return promises; } - return batch.map( - async ({ - configuration, - configurationName, - id, - kind, - story, - parameters, - }) => { - const screenshot = await target.captureScreenshotForStory( - id, - options, + return batch + .filter(({ configurationName, parameters }) => { + if (parameters.configurationFilter) { + const testConfiguration = new RegExp(parameters.configurationFilter); + + if (!testConfiguration.test(configurationName)) { + return false; + } + } + return true; + }) + .map( + async ({ configuration, - parameters - ); - return compareScreenshot( - screenshot, - options, - tolerance, configurationName, + id, kind, - story - ); - } - ); + story, + parameters, + }) => { + const screenshot = await target.captureScreenshotForStory( + id, + options, + configuration, + parameters + ); + return compareScreenshot( + screenshot, + options, + tolerance, + configurationName, + kind, + story + ); + } + ); } module.exports = testBatch;