Skip to content

Commit

Permalink
filter arg now uses regex strings instead of includes
Browse files Browse the repository at this point in the history
  • Loading branch information
garris committed Jan 13, 2017
1 parent dded9e2 commit 97d1e71
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions core/util/createBitmaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@ var logger = require('./logger')('createBitmaps');

var GENERATE_BITMAPS_SCRIPT = 'capture/genBitmaps.js';

function includes (string, search, start) {
if (typeof start !== 'number') {
start = 0;
}

if (start + search.length > this.length) {
return false;
} else {
return string.indexOf(search, start) !== -1;
}
function regexTest (string, search) {
var re = new RegExp(search);
return re.test(string);
}


/**
* Utility for generating a temporary config file required by GENERATE_BITMAPS_SCRIPT.
* @config {Object} Base user config object (derrived by user config file + CL param overrides).
Expand All @@ -40,7 +32,7 @@ function writeReferenceCreateConfig (config, isReference) {

config.args.filter.split(',').forEach(function (filteredTest) {
each(configJSON.scenarios, function (scenario) {
if (includes(scenario.label, filteredTest)) {
if (regexTest(scenario.label, filteredTest)) {
scenarii.push(scenario);
}
});
Expand Down

0 comments on commit 97d1e71

Please sign in to comment.