forked from openlayers/openlayers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-rendering.js
61 lines (51 loc) · 1.57 KB
/
test-rendering.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
/**
* This task starts a dev server that provides a script loader for OpenLayers
* and Closure Library and runs rendering tests in SlimerJS.
*/
var path = require('path');
var spawn = require('child_process').spawn;
var slimerjs = require('slimerjs');
var serve = require('./serve');
var listen = require('./test').listen;
/**
* Create the debug server and run tests.
*/
serve.createServer(function(err, server) {
if (err) {
process.stderr.write(err.message + '\n');
process.exit(1);
}
listen(3001, 3005, server, function(err) {
if (err) {
process.stderr.write('Server failed to start: ' + err.message + '\n');
process.exit(1);
}
var address = server.address();
var url = 'http://' + address.address + ':' + address.port;
var profile = path.join(__dirname, '../build/slimerjs-profile');
var args = [
'-profile',
profile,
path.join(__dirname,
'../test_rendering/test.js'),
url + '/test_rendering/index.html'
];
// TODO
// Workaround for https://github.com/laurentj/slimerjs/issues/333. When a
// version with the fix is released, replace block below with:
// var child = spawn(slimerjs.path, args, {stdio: 'pipe'});
// child.on('exit', function(code) {
// process.exit(code);
// }
var child = spawn(slimerjs.path, args, {stdio: 'pipe'});
child.stdout.on('data', function(data) {
process.stdout.write(data);
if (data == 'All tests passed.\n') {
process.exit(0);
}
});
child.on('exit', function() {
process.exit(1);
});
});
});