1 var tap = require('tap')
2 var pz = require('../promzard.js')
3 var spawn = require('child_process').spawn
5 tap.test('run the example using a buffer', function (t) {
7 var example = require.resolve('../example/buffer.js')
8 var node = process.execPath
13 "description": "testing description",
14 "main": "test-entry.js",
24 "test": "tap test/*.js"
28 "url": "git://github.com/substack/example.git"
30 "homepage": "https://github.com/substack/example",
38 "name": "James Halliday",
39 "email": "mail@substack.net",
40 "url": "http://substack.net"
48 var c = spawn(node, [example], { customFds: [-1,-1,-1] })
50 c.stdout.on('data', function (d) {
56 c.stderr.on('data', function (d) {
61 if (output.match(/description: $/)) {
62 c.stdin.write('testing description\n')
65 if (output.match(/entry point: \(index\.js\) $/)) {
66 c.stdin.write('test-entry.js\n')
69 if (output.match(/keywords: $/)) {
70 c.stdin.write('fugazi function waiting room\n')
71 // "read" module is weird on node >= 0.10 when not a TTY
72 // requires explicit ending for reasons.
73 // could dig in, but really just wanna make tests pass, whatever.
79 c.on('close', function () {
80 actual = JSON.parse(actual)
81 t.deepEqual(actual, expect)