mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 11:15:24 +03:00
Decaffeinate the following files. * atom-protocol-handler * babel-spec * buffered-node-process * buffered-process * clipboard * context-menu-manager * decoration-manager * default-directory-provider * deserializer-manager * file-system-blob-store * keymap-extensions * menu-manager * module-cache * pane-axis-element * pane-container-element * pane-element * package-spec * squirel-update * styles-element-spec * task-spec * typescript-spec * spec-helper-platform
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
/* 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('');
|
|
});
|
|
});
|
|
});
|