-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathmake_baseline.js
89 lines (80 loc) · 2 KB
/
make_baseline.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
var minimist = require('minimist');
var path = require('path');
var spawn = require('child_process').spawn;
var getMockList = require('./assets/get_mock_list');
/**
* Baseline image generation script.
*
* CLI arguments:
*
* 1. 'pattern' : glob determining the baseline(s) to be generated
*
* Examples:
*
* Generate or (re-generate) all baselines:
*
* npm run baseline
*
* Generate or (re-generate) the 'contour_nolines' baseline:
*
* npm run baseline -- contour_nolines
*
* Generate or (re-generate) all gl3d baseline:
*
* npm run baseline -- gl3d_*
*
* Generate or (re-generate) baselines using mathjax3:
*
* npm run baseline mathjax3
*
* Generate or (re-generate) baselines using b64 typed arrays:
*
* npm run baseline b64
*
*/
var argv = minimist(process.argv.slice(2), {});
var allMockList = [];
var mathjax3, b64;
argv._.forEach(function(pattern) {
if(pattern === 'b64') {
b64 = true;
} else if(pattern === 'mathjax3') {
mathjax3 = true;
} else {
var mockList = getMockList(pattern);
if(mockList.length === 0) {
throw new Error('No mocks found with pattern ' + pattern);
}
allMockList = allMockList.concat(mockList);
}
});
if(mathjax3) {
allMockList = [
'legend_mathjax_title_and_items',
'mathjax',
'parcats_grid_subplots',
'table_latex_multitrace_scatter',
'table_plain_birds',
'table_wrapped_birds',
'ternary-mathjax',
'zz-ternary-mathjax-title-place-subtitle'
];
}
if(allMockList.length) console.log(allMockList);
console.log('Please wait for the process to complete.');
var p = spawn(
'python3', [
path.join('test', 'image', 'make_baseline.py'),
(mathjax3 ? 'mathjax3' : '') +
(b64 ? 'b64' : '') +
'= ' + allMockList.join(' ')
]
);
try {
p.stdout.on('data', function(data) {
console.log(data.toString());
});
} catch(e) {
console.error(e.stack);
p.exit(1);
}