test('pino.extreme() emits a warning', async ({ is }) => { const pino = require('..') process.removeAllListeners('warning') process.nextTick(() => pino.extreme(0)) const warning = await once(process, 'warning') const expected = 'The pino.extreme() option is deprecated and will be removed in v7. Use pino.destination({ sync: false }) instead.' is(expected, warning.message) is('extreme_deprecation', warning.code) })
_read() { if (this._ended) return; this._ended = true; process.nextTick(_ => { this.push(Buffer.from(this._str, 'utf8')); this.push(null); }); }
// Wait to see if we're a nested instance process.nextTick(function () { if (self.instance.parent !== undefined) { self.relative = true; } });
t.test('let error pass through', ({ is, plan }) => { plan(3) const stream = pino.destination() // side effect of the pino constructor is that it will set an // event handler for error pino(stream) process.nextTick(() => stream.emit('error', new Error('kaboom'))) process.nextTick(() => stream.emit('error', new Error('kaboom'))) stream.on('error', (err) => { is(err.message, 'kaboom') }) })
function guardedCheck() { if (isChecking || !needsCheck) { return; } isChecking = true; var filepaths = Object.keys(toCheck); toCheck = {}; needsCheck = false; checkFiles(filepaths).then(() => { isChecking = false; process.nextTick(guardedCheck); }); }
/** * subscribe * * @param {Object} reg * - {String} dataId - the dataId * @param {Function} listener - the listener */ subscribe(reg, listener) { const key = reg.dataId; this.on(key, listener); const data = this._registered.get(key); if (data) { process.nextTick(() => listener(data)); } }
ready(flagOrFunction) { this._ready = !!this._ready; this._readyCallbacks = this._readyCallbacks || []; if (typeof flagOrFunction === 'function') { this._readyCallbacks.push(flagOrFunction); } else { this._ready = !!flagOrFunction; } if (this._ready) { this._readyCallbacks.splice(0, Infinity).forEach(function(callback) { process.nextTick(callback); }); } return this; }
function Then(callback, getContext) { var length = callback.length; return function (context, data, next, done) { var self = this, calledDone = false; getContext(context, function (context) { callback.call(self, context, data.getObject(), function (c, d) { next(c, data.setObject(d)); if (length === 3 && calledDone === false) { process.nextTick(done); calledDone = true; } }, done); if (length <= 2) { next(context, data); done(); } }); }; }
resolvedPromise.then(() => { process.nextTick(fn); });
request(url, args, callback) { if (typeof args === 'function') { callback = args; args = null; } args = args || {}; if (args.ctx && args.ctx.tracer) { args.tracer = args.ctx.tracer; } else { args.tracer = args.tracer || this.app.tracer; } // the callback style if (callback) { this.app.deprecate('[httpclient] We now support async for this function, so callback isn\'t recommended.'); super.request(url, args) .then(result => process.nextTick(() => callback(null, result.data, result.res))) .catch(err => process.nextTick(() => callback(err))); return; } // the Promise style return super.request(url, args); }
process.nextTick(function () { self.started = true; self.command.start(); });
it('user modified while saving', done => { Parse.Object.disableSingleInstance(); const user = new Parse.User(); user.set('username', 'alice'); user.set('password', 'password'); user.signUp().then(function(userAgain) { equal(userAgain.get('username'), 'bob'); ok(userAgain.dirty('username')); const query = new Parse.Query(Parse.User); query.get(user.id).then(freshUser => { equal(freshUser.id, user.id); equal(freshUser.get('username'), 'alice'); done(); }); }); // Jump a frame so the signup call is properly sent // This is due to the fact that now, we use real promises process.nextTick(() => { ok(user.set('username', 'bob')); }); });
request(url, args, callback) { // request(url, callback) if (typeof args === 'function') { callback = args; args = null; } // the callback style if (callback) { this.app.deprecate('[dnscache_httpclient] We now support async for this function, so callback isn\'t recommended.'); this[DNSLOOKUP](url, args) .then(result => { return super.request(result.url, result.args); }) .then(result => process.nextTick(() => callback(null, result.data, result.res))) .catch(err => process.nextTick(() => callback(err))); return; } // the Promise style return (async () => { const result = await this[DNSLOOKUP](url, args); return super.request(result.url, result.args); })(); }
process.nextTick(function () { var instance; if (self.count === 0) { instance = self.instance; instance.command.done(); if (instance.opts.debug === true) { instance.resources(); } } });
process.nextTick(function () { if (self.next !== undefined) {