How to use the test-console.stderr.inspectSync 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
// $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
stderr.ignoreSync();
// $ExpectType void
stderr.ignoreSync(() => {});
// $ExpectError
stderr.ignoreSync({}, (output) => output);
github cerner / f-twelve / test / unit / views / content / console / console.js View on Github external
it('should write the error to stderr', function() {
      window.onerror = null;
      this.console.overrideWindowOnError();
      stderr.inspectSync((output) => {
        window.onerror('', '', 0, 0, 'string');
        window.onerror('', '', 0, 0, [1, 2, 3]);
        window.onerror('', '', 0, 0, { key: 'value' });
        assert.deepStrictEqual(output, ['string\n', '[ 1, 2, 3 ]\n', "{ key: 'value' }\n"]);
      });
    });
  });
github toajs / toa / test / index.js View on Github external
tman.it('should transform non-error to error object', function () {
    const app = new Toa()

    let err = 'Foo'
    let output = stderr.inspectSync(function () {
      app.onerror(err)
    })

    assert.strictEqual(output[0].indexOf('  Error: non-error thrown: \'Foo\'\n'), 0)
  })
})
github toajs / toa / test / index.js View on Github external
tman.it('should do nothing if status is 404', function () {
    const app = new Toa()
    let err = new Error()

    err.status = 404

    let output = stderr.inspectSync(function () {
      app.onerror(err)
    })

    assert.deepStrictEqual(output, [])
  })