Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 58 lines (46 sloc) 1.699 kb
f01b114 @lloyd get frontend unit tests running under phantomjs - issue #635
lloyd authored
1 #!/usr/bin/env node
2
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 require('../tests/lib/test_env.js');
8
9 const assert =
10 require('assert'),
11 vows = require('vows'),
12 start_stop = require('../tests/lib/start-stop.js'),
13 spawn = require('child_process').spawn,
14 path = require('path');
15
16 var suite = vows.describe('frontend-tests');
17
18 // disable vows (often flakey?) async error behavior
19 suite.options.error = false;
20
bfca084 @lloyd by default, run all tests during npm test, and emit clear errors when…
lloyd authored
21 suite.addBatch({
22 "PhantomJS binary": {
23 topic: function() {
24 var kid = spawn('phantomjs', [ '--version' ]);
25 kid.on('exit', this.callback);
26 },
27 "is in path and executable": function(code) {
28 assert.strictEqual(code, 0);
29 }
30 }
31 });
32
f01b114 @lloyd get frontend unit tests running under phantomjs - issue #635
lloyd authored
33 start_stop.addStartupBatches(suite);
34
35 suite.addBatch({
36 "frontend unit tests": {
37 topic: function() {
4e9d6bd @jedp added test filter option for use from shell
jedp authored
38 var filter = process.env['FRONTEND_TEST_FILTER'] ?
39 '?filter=' + process.env['FRONTEND_TEST_FILTER'] : '';
5cfe1f3 @lloyd move phantomrunner.js out of a web accessible directory
lloyd authored
40 var kid = spawn('phantomjs', [ path.join(__dirname, 'phantomrunner.js'),
4e9d6bd @jedp added test filter option for use from shell
jedp authored
41 'http://127.0.0.1:10002/test/'+filter ]);
f01b114 @lloyd get frontend unit tests running under phantomjs - issue #635
lloyd authored
42 kid.stdout.on('data', function(d) { process.stdout.write(d); });
43 kid.stderr.on('data', function(d) { process.stderr.write(d); });
44 kid.on('exit', this.callback);
45 },
46 "pass!": function(code) {
47 assert.strictEqual(code, 0);
48 }
49 }
50 });
51
52 start_stop.addShutdownBatches(suite);
53
54 // run or export the suite.
55 if (process.argv[1] === __filename) suite.run({}, function(r) { process.exit(r.honored == r.total ? 0 : 1); });
56 else suite.export(module);
57
Something went wrong with that request. Please try again.