Skip to content

Commit

Permalink
Merge pull request #4412 from plotly/make-baseline-multiple-mocks
Browse files Browse the repository at this point in the history
Handle multiple positional args in make_baseline.js script
  • Loading branch information
etpinard authored Dec 5, 2019
2 parents 89e46b1 + 5eda6c9 commit 9484b7e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/image/make_baseline.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var fs = require('fs');
var minimist = require('minimist');

var getMockList = require('./assets/get_mock_list');
var getRequestOpts = require('./assets/get_image_request_options');
Expand Down Expand Up @@ -34,15 +35,22 @@ var QUEUE_WAIT = 10;
* npm run baseline -- gl3d_*
*
*/
var pattern = process.argv[2];
var mockList = getMockList(pattern);

if(mockList.length === 0) {
throw new Error('No mocks found with pattern ' + pattern);
}
var argv = minimist(process.argv.slice(2), {});

var allMockList = [];
argv._.forEach(function(pattern) {
var mockList = getMockList(pattern);

if(mockList.length === 0) {
throw new Error('No mocks found with pattern ' + pattern);
}

allMockList = allMockList.concat(mockList);
});

// main
runInQueue(mockList);
runInQueue(allMockList);

function runInQueue(mockList) {
var index = 0;
Expand Down

0 comments on commit 9484b7e

Please sign in to comment.