Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// $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);
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"]);
});
});
});
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)
})
})
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, [])
})