-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuffered-node-process-spec.js
47 lines (39 loc) · 1.3 KB
/
buffered-node-process-spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* eslint-disable no-new */
const path = require('path');
const BufferedNodeProcess = require('../src/buffered-node-process');
describe('BufferedNodeProcess', function() {
it('executes the script in a new process', function() {
const exit = jasmine.createSpy('exitCallback');
let output = '';
const stdout = lines => (output += lines);
let error = '';
const stderr = lines => (error += lines);
const args = ['hi'];
const command = path.join(__dirname, 'fixtures', 'script.js');
new BufferedNodeProcess({ command, args, stdout, stderr, exit });
waitsFor(() => exit.callCount === 1);
runs(function() {
expect(output).toBe('hi');
expect(error).toBe('');
expect(args).toEqual(['hi']);
});
});
it('suppresses deprecations in the new process', function() {
const exit = jasmine.createSpy('exitCallback');
let output = '';
const stdout = lines => (output += lines);
let error = '';
const stderr = lines => (error += lines);
const command = path.join(
__dirname,
'fixtures',
'script-with-deprecations.js'
);
new BufferedNodeProcess({ command, stdout, stderr, exit });
waitsFor(() => exit.callCount === 1);
runs(function() {
expect(output).toBe('hi');
expect(error).toBe('');
});
});
});