How to use the test-console.stderr.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
// $ExpectType Restore
stdout.ignore();
// $ExpectType Restore
stdout.ignore({isTTY: false});

// $ExpectError
stdout.ignoreSync();
// $ExpectType void
stdout.ignoreSync(() => {});
// $ExpectError
stdout.ignoreSync({}, (output) => output);
// $ExpectType void
stdout.ignoreSync({}, () => {});

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

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

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

// $ExpectError
github adonisjs / adonis-framework / test / ignitor-ace.spec.ts View on Github external
test('raise error when outdir inside tsconfig file is missing', async (assert) => {
    await setupApplicationFiles(fs)
    const { output, restore } = stderr.inspect()

    /**
     * Overwriting .adonisrc.json
     */
    await fs.add('.adonisrc.json', JSON.stringify({
      typescript: true,
    }))

    await fs.add('tsconfig.json', JSON.stringify({
    }))

    const ignitor = new Ignitor(fs.basePath)
    await ignitor.ace().handle(['generate:manifest'])
    restore()

    assert.equal(
github weo-edu / redux-gen / test / index.js View on Github external
const dispatch = () => {
    var err = new Error()
    err.stack = 'Foo'
    throw err
  }

  let handlerCalled = false
  const errorHandler = () => {
    console.log('error handler')
    handlerCalled = true
  }

  const nextHandler = reduxGen(errorHandler)({dispatch: dispatch})
  const actionHandler = nextHandler()

  let inspect = stderr.inspect()

  actionHandler(function *() {
    yield 'foo'
  }).then(function() {
    t.deepEqual(inspect.output, [])
    t.equal(handlerCalled, true)
    inspect.restore()
  })
})
github jonathaneunice / iterm2-tab-set / test / test_util.js View on Github external
it('should print output plus newline to stderr', function () {
      var stde = stderr.inspect();
      error(1, 'this', 'that');
      stde.restore();
      assert.equal(stde.output[0], '1 this that\n');
    });
  })
github brunch / brunch / test / _test_helper.js View on Github external
const spyOnConsole = () => {
  _inspect = _stdout.inspect();
  _inspectE = _stderr.inspect();
};
github jaridmargolin / inspect-process / test / index.js View on Github external
beforeEach(function () {
    this.stdout = stdout.inspect()
    this.stderr = stderr.inspect()
  })
github redux-effects / redux-flo / test / index.js View on Github external
const dispatch = () => {
    var err = new Error()
    err.stack = 'Foo'
    throw err
  }

  let handlerCalled = false
  const errorHandler = () => {
    handlerCalled = true
  }

  const nextHandler = flow(errorHandler)({dispatch: dispatch})
  const actionHandler = nextHandler()

  let inspect = stderr.inspect()

  actionHandler(function * () {
    yield 'foo'
  }).then(() => {
    t.deepEqual(inspect.output, [])
    t.equal(handlerCalled, true)
    inspect.restore()
  })
})