pulsar/spec/buffered-node-process-spec.js
Sadick 83d6c09b10
Decaffeinate specs (#21546)
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
2020-10-30 16:40:57 +03:00

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('');
});
});
});