UNPKG

grover

Version:

PhantomJS wrapper for YUITest

87 lines (81 loc) 2.96 kB
var vows = require('vows'), assert = require('assert'), path = require('path'), grover = require('../lib/grover'), util = require('../lib/'); var tests = { 'should process several files': { topic: function() { var self = this, _exit = util.exit; util.exit = function() {}; process.argv = [ null, null, '--concurrent', '5', '--outfile', path.join(__dirname, 'out/tap.info'), '--tap', '--no-run', path.join(__dirname, './html/good.html'), path.join(__dirname, './html/bad.html'), path.join(__dirname, './html/error.html') ]; grover.process(function(err, results) { util.exit = _exit; self.callback(err, results); }); setTimeout(function() { process.emit('message', { 'continue': true }); process.emit('message', { 'foo': true }); }, 3500); }, 'should have results': function(topic) { assert.ok(topic); }, 'should have 3 sets of results': function(topic) { assert.equal(topic.length, 3); }, 'should have 50 passing tests in Suite #1': function(topic) { var topics = topic.filter(function(item) { return (item.name === 'Suite #1'); }); assert.equal(topics[0].passed, 50); }, 'should have 0 failing tests in Suite #1': function(topic) { var topics = topic.filter(function(item) { return (item.name === 'Suite #1'); }); assert.equal(topics[0].failed, 0); }, 'should have 5 passing tests in Suite Bad': function(topic) { var topics = topic.filter(function(item) { return (item.name === 'Suite Bad'); }); assert.equal(topics[0].passed, 5); }, 'should have 5 failing tests in Suite Bad': function(topic) { var topics = topic.filter(function(item) { return (item.name === 'Suite Bad'); }); assert.equal(topics[0].failed, 5); }, 'should 1 failing test in error.html': function(topic) { var topics = topic.filter(function(item) { return (item.name.indexOf('error.html') > -1); }); assert.equal(topics[0].failed, 1); }, 'should have an outfile': { topic: function() { return util.existsSync(path.join(__dirname, 'out/tap.info')); }, 'and it exists': function(topic) { assert.isTrue(topic); } } } }; /*jshint es5: true */ vows.describe('process.message').addBatch(tests).export(module);