Sha256: 96f6953a105434c4ad46f555b43ed9db3e823993dfe6d3977e090e5413520ed1
Contents?: true
Size: 803 Bytes
Versions: 7
Compression:
Stored size: 803 Bytes
Contents
var test = require('tap').test; var spawn = require('child_process').spawn; var concat = require('concat-stream'); var path = require('path'); var vm = require('vm'); test('stdin', function (t) { t.plan(2); var cwd = process.cwd(); process.chdir(__dirname); var ps = spawn(process.execPath, [ path.resolve(__dirname, '../bin/cmd.js'), '-' ]); ps.stdout.pipe(concat(function (body) { var c = { console: { log: function (msg) { t.equal(msg, 'hello'); } } }; vm.runInNewContext(body, c); })); ps.stderr.pipe(process.stderr); ps.on('exit', function (code) { t.equal(code, 0); }); ps.stdin.write("console.log('hello')"); ps.stdin.end(); });
Version data entries
7 entries across 7 versions & 2 rubygems