Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// $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
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(
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()
})
})
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');
});
})
const spyOnConsole = () => {
_inspect = _stdout.inspect();
_inspectE = _stderr.inspect();
};
beforeEach(function () {
this.stdout = stdout.inspect()
this.stderr = stderr.inspect()
})
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()
})
})