UNPKG

ember-cli

Version:

Command line tool for developing ambitious ember.js apps

36 lines (27 loc) 768 B
'use strict'; let EventEmitter = require('events'); module.exports = class MockProcess extends EventEmitter { constructor(options) { super(); options = options || {}; this.platform = 'MockOS'; const stdin = Object.assign(new EventEmitter(), { isRaw: process.stdin.isRaw, setRawMode: flag => { stdin.isRaw = flag; }, }, options.stdin || {}); Object.assign(this, options, { stdin }); } getSignalListenerCounts() { return { SIGINT: this.listenerCount('SIGINT'), SIGTERM: this.listenerCount('SIGTERM'), message: this.listenerCount('message'), }; } exit() { // we are unable to reliable unit test `process.exit()` throw new Error("MockProcess.exit() was called"); } };