forked from mozilla/botio-files-pdfjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
on_cmd_unittest.js
52 lines (42 loc) · 1.1 KB
/
on_cmd_unittest.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
var botio = require(process.env['BOTIO_MODULE']);
require('shelljs/global');
var fail = false;
exec('npm install', {async:false});
exec('git submodule init', {async:false});
exec('git submodule update', {async:false});
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');
//
// Unit Tests
//
echo();
echo('>> Unit Tests');
exec('gulp unittest', {silent:false, async:true}, function(error, output) {
var successMatch = output.match(/All unit tests passed/g);
if (successMatch) {
botio.message('+ **Unit Tests:** Passed');
} else {
botio.message('+ **Unit Tests:** FAILED');
fail = true; // non-fatal, continue
}
//
// Update local cache of PDF files
//
echo();
echo('>> Updating local PDF cache')
mkdir('-p', __dirname+'/pdf-cache');
cp('./test/pdfs/*.pdf', __dirname+'/pdf-cache');
if (fail)
exit(1);
}); // exec unit tests