-
Notifications
You must be signed in to change notification settings - Fork 9
/
on_cmd_makeref.js
64 lines (55 loc) · 1.58 KB
/
on_cmd_makeref.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
var botio = require(process.env['BOTIO_MODULE']);
require('shelljs/global');
exec('npm ci', {async:true}, function() {
silent(true);
//
// Get PDFs from local cache
//
echo();
echo('>> Deploying cached PDF files');
cp(__dirname+'/pdf-cache/*', './test/pdfs');
//
// Deploy custom files
//
echo();
echo('>> Deploying custom files');
cp('-f', __dirname+'/test-files/browser_manifest.json', './test/resources/browser_manifests');
//
// Make refs
//
echo();
echo('>> Making references');
// Using {async} to avoid unnecessary CPU usage
exec('npx gulp botmakeref', {silent:false, async:true}, function(error, output) {
var successMatch = output.match(/All regression tests passed/g);
if (successMatch) {
botio.message('+ **Make references:** Passed');
} else {
botio.message('+ **Make references:** FAILED');
exit(1); // fatal, no point in continuing
}
//
// Sanity check
//
if (test('-d', './test/tmp')) {
botio.message('+ **Check references:** Passed');
} else {
botio.message('+ **Check references:** FAILED (no refs found)');
exit(1); // fatal, no point in continuing
}
//
// Push up-to-date reference snapshots
//
echo();
echo('>> Updating ref snapshots');
mkdir('-p', __dirname+'/refs');
cp('-Rf', './test/tmp/*', __dirname+'/refs');
//
// Update local cache of PDF files
//
echo();
echo('>> Updating local PDF cache')
mkdir('-p', __dirname+'/pdf-cache');
cp('./test/pdfs/*.pdf', __dirname+'/pdf-cache');
}); // exec makeref
}); // npm ci