Skip to content
This repository
tag: train-2012.03.…
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 56 lines (44 sloc) 1.56 kb
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
#!/usr/bin/env node

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

require('../tests/lib/test_env.js');

const assert =
require('assert'),
vows = require('vows'),
start_stop = require('../tests/lib/start-stop.js'),
spawn = require('child_process').spawn,
path = require('path');

var suite = vows.describe('frontend-tests');

// disable vows (often flakey?) async error behavior
suite.options.error = false;

suite.addBatch({
  "PhantomJS binary": {
    topic: function() {
      var kid = spawn('phantomjs', [ '--version' ]);
      kid.on('exit', this.callback);
    },
    "is in path and executable": function(code) {
      assert.strictEqual(code, 0);
    }
  }
});

start_stop.addStartupBatches(suite);

suite.addBatch({
  "frontend unit tests": {
    topic: function() {
      var kid = spawn('phantomjs', [ path.join(__dirname, 'phantomrunner.js'),
                                     'http://127.0.0.1:10002/test' ]);
      kid.stdout.on('data', function(d) { process.stdout.write(d); });
      kid.stderr.on('data', function(d) { process.stderr.write(d); });
      kid.on('exit', this.callback);
    },
    "pass!": function(code) {
      assert.strictEqual(code, 0);
    }
  }
});

start_stop.addShutdownBatches(suite);

// run or export the suite.
if (process.argv[1] === __filename) suite.run({}, function(r) { process.exit(r.honored == r.total ? 0 : 1); });
else suite.export(module);

Something went wrong with that request. Please try again.