1 | var test = require('tape')
|
2 | var spawn = require('child_process').spawn
|
3 |
|
4 | test('things', function (t) {
|
5 | var proc = spawnTest(['fixtures/othertest.js'], function (output) {
|
6 | t.equal(output.stderr, '', 'no stderr')
|
7 | t.equal(output.stdout,
|
8 | 'TAP version 13\n# dummy test\nok 1 works\n\n1..1\n' +
|
9 | '# tests 1\n# pass 1\n\n# ok\n',
|
10 | 'prints tap output')
|
11 | t.equal(output.code, null, 'exited successfully')
|
12 | t.end()
|
13 | })
|
14 |
|
15 | setTimeout(function () {
|
16 | proc.kill('SIGHUP')
|
17 | }, 1000)
|
18 | })
|
19 |
|
20 | test('eslint', require('eslint-engine/tape')())
|
21 |
|
22 | function spawnTest (args, fn) {
|
23 | var proc = spawn('./bin/tape-watch', args)
|
24 | var output = { stdout: '', stderr: '', code: undefined }
|
25 |
|
26 | proc.stdout.on('data', function (data) {
|
27 | output.stdout += data
|
28 | })
|
29 |
|
30 | proc.stderr.on('data', function (data) {
|
31 | output.stderr += data
|
32 | })
|
33 |
|
34 | proc.on('close', function (code) {
|
35 | output.code = code
|
36 | fn(output)
|
37 | })
|
38 |
|
39 | return proc
|
40 | }
|