| | |
| | |
| | |
| | |
| |
|
| | import * as assert from 'assert'; |
| | import { WindowsTerminal } from './windowsTerminal'; |
| | import { UnixTerminal } from './unixTerminal'; |
| | import { pollUntil } from './testUtils.test'; |
| |
|
| | const terminalConstructor = (process.platform === 'win32') ? WindowsTerminal : UnixTerminal; |
| | const SHELL = (process.platform === 'win32') ? 'cmd.exe' : '/bin/bash'; |
| |
|
| | let terminalCtor: WindowsTerminal | UnixTerminal; |
| | if (process.platform === 'win32') { |
| | terminalCtor = require('./windowsTerminal'); |
| | } else { |
| | terminalCtor = require('./unixTerminal'); |
| | } |
| |
|
| |
|
| | describe('Terminal', () => { |
| | describe('constructor', () => { |
| | it('should do basic type checks', () => { |
| | assert.throws( |
| | () => new (<any>terminalCtor)('a', 'b', { 'name': {} }), |
| | 'name must be a string (not a object)' |
| | ); |
| | }); |
| | }); |
| |
|
| | describe('automatic flow control', () => { |
| | it('should respect ctor flow control options', () => { |
| | const pty = new terminalConstructor(SHELL, [], {handleFlowControl: true, flowControlPause: 'abc', flowControlResume: '123'}); |
| | assert.equal(pty.handleFlowControl, true); |
| | assert.equal((pty as any)._flowControlPause, 'abc'); |
| | assert.equal((pty as any)._flowControlResume, '123'); |
| | }); |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | }); |
| | }); |
| |
|
| | function stripEscapeSequences(data: string): string { |
| | return data.replace(/\u001b\[0K/, ''); |
| | } |
| |
|