You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
616 B
26 lines
616 B
var test = require('tap').test;
|
|
var exec = require('child_process').exec;
|
|
|
|
var vm = require('vm');
|
|
var fs = require('fs');
|
|
|
|
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
|
|
|
|
test('cmd.js', function (t) {
|
|
t.plan(1);
|
|
exec(__dirname + '/../bin/cmd.js ' + __dirname + '/files/main.js',
|
|
function (error, stdout, stderr) {
|
|
if (error !== null) {
|
|
t.fail();
|
|
} else {
|
|
vm.runInNewContext(stdout, {
|
|
require: function () {},
|
|
console: { log: log }
|
|
});
|
|
function log (msg) {
|
|
t.equal(html, msg);
|
|
};
|
|
};
|
|
}
|
|
);
|
|
});
|