How to use the test-console.stdout.inspect function in test-console

To help you get started, we’ve selected a few test-console examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / test-console / test-console-tests.ts View on Github external
import { stdout, stderr } from 'test-console';

// $ExpectType Inspector
stdout.inspect();
// $ExpectType Inspector
stdout.inspect({isTTY: true});

// $ExpectError
stdout.inspectSync();
// $ExpectError
stdout.inspectSync({});
// $ExpectType ReadonlyArray || Output
stdout.inspectSync({isTTY: false}, (output) => output);

// $ExpectType Restore
stdout.ignore();
// $ExpectType Restore
stdout.ignore({isTTY: false});

// $ExpectError
stdout.ignoreSync();
// $ExpectType void
github 0vidiu / frontvue / src / dependencies-manager / dependencies-installer.spec.ts View on Github external
it('logs out using the error channel', () => {
      // Catch all console logs
      const inspect = stdout.inspect();

      // Mocking the stderr stream
      (new Stream())
        .on('data', data => installer.logError(data))
        .emit('data', 'Some nasty error here');

      inspect.restore();
      expect(inspect.output.join(' ')).to.satisfy(StringIncludesAll('ERROR', 'Some nasty error here'));
    });
  });
github jonathaneunice / iterm2-tab-set / test / test_util.js View on Github external
it('should print output plus newline', function () {
      var stdo = stdout.inspect();
      println(1, 'this', 'that');
      stdo.restore();
      assert.equal(stdo.output[0], '1 this that\n');
    });
  })
github adonisjs / adonis-framework / test / unit / logger.spec.js View on Github external
test('proxy logger instance methods', (assert) => {
    const config = new Config()
    config.set('app.logger', {
      transport: 'console',
      console: {
        driver: 'console'
      }
    })

    const logger = new LoggerFacade(config)
    const inspect = stdout.inspect()

    logger.info('hello')
    inspect.restore()
    assert.include(inspect.output[0], 'hello')
  })
github brunch / brunch / test / _test_helper.js View on Github external
const spyOnConsole = () => {
  _inspect = _stdout.inspect();
  _inspectE = _stderr.inspect();
};
github salesforce / refocus / tests / realtime / pubSubStats.js View on Github external
beforeEach(() => {
      inspect = stdout.inspect();
      delete global[globalKey];
      pss.track('pub', 'bye.world', { updatedAt: Date.now() - 1000 });
      pss.track('pub', 'bye.world', { updatedAt: Date.now() - 1000 });
      pss.track('pub', 'bye.world', { updatedAt: Date.now() - 1000 });
      pss.track('pub', 'hello.world', { updatedAt: Date.now() - 1 });
      pss.track('sub', 'hello.world', { updatedAt: Date.now() - 1 });
      pss.track('sub', 'bye.world', { updatedAt: Date.now() - 1 });
      pss.log('MyProcessName');
    });
github jaridmargolin / inspect-process / test / index.js View on Github external
beforeEach(function () {
    this.stdout = stdout.inspect()
    this.stderr = stderr.inspect()
  })
github chiefy / metalsmith-express / test / test_log.js View on Github external
function testLog(fn, ...args) {
  let inspect = stdout.inspect()
  let result  = (fn(...args)).pop()
  inspect.restore()
  return result.pop()
}
github 0vidiu / frontvue / src / util / logger.spec.ts View on Github external
beforeEach(() => {
      inspect = stdout.inspect();
    });
github 0vidiu / frontvue / src / util / utility-functions.spec.ts View on Github external
      beforeEach(() => inspect = stdout.inspect());
      afterEach(() => {