function endWritable( stream, state, cb ) { state.ending = true; finishMaybe( stream, state ); if ( cb ) { if ( state.finished ) process.nextTick( cb ); else stream.once( 'finish', cb ); } state.ended = true; }
req.once('dest', function(_req) { setReqStatus(); reqEmitter.emit('send', data); !hasReqPipe && handleReqBody(_req, req); });
gulp.task('watch', (done) => { // Watch LESS files and generate CSS watch(['public/stylesheets/less/**/*.less'], async () => { lessCss(); console.log(colors.blue('CSS generation complete')); }); // run, watch and restart app nodemon(nodemonOptions) .once('quit', () => { done(); }); });
onRequest(pollyRequest) { const { req } = pollyRequest.requestArguments; if (req.aborted) { pollyRequest.abort(); } else { pollyRequest[ABORT_HANDLER] = () => pollyRequest.abort(); req.once('abort', pollyRequest[ABORT_HANDLER]); } }
it('should be event-able', function() { expect(Polly.on).to.be.a('function'); expect(Polly.once).to.be.a('function'); expect(Polly.off).to.be.a('function'); });
test('dateformat', async ({ isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'dateformat.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(strip(actual).match(/\(123456 on abcdefghijklmnopqr\): h/), null) })
startChild() { let worker = new Worker(this.options); worker.fork(this.options.workerPath, this.bundlerOptions); worker.on("request", data => this.processRequest(data, worker)); worker.on("ready", () => this.processQueue()); worker.on("response", () => this.processQueue()); worker.on("error", err => this.onError(err, worker)); worker.once("exit", () => this.stopWorker(worker)); this.workers.set(worker.id, worker); }
test.before(() => { nock(URL).get('/no-cache').times(2).reply(200, {foo: 'bar'}); nock(URL).get('/cache').once().reply(200, {hello: 'world'}); nock(URL).get('/cache').twice().reply(200, {hello: 'world!'}); nock(URL).get('/cache-key?unicorn=rainbow').reply(200, {unicorn: 'rainbow'}); nock(URL).get('/cache-version').once().reply(200, {foo: 'bar'}); nock(URL).get('/cache-version').twice().reply(200, {unicorn: 'rainbow'}); });
prompt.once('run', () => { int = setInterval(() => { if (time-- === 0) { prompt.state.input = ''; prompt.cancel(); } else { prompt.render(); } }, 1000); });
test('supports leading bracket notation (single-segment path)', async ({ is }) => { const stream = sink() const instance = pino({ redact: ['[`a.a`]'] }, stream) const obj = { 'a.a': { b: 'c' } } instance.info(obj) const o = await once(stream, 'data') is(o['a.a'], '[Redacted]') })
prompt.once('run', async() => { for (const step of steps) { await timeout(() => prompt.keypress(...step.keypress), step.ms); } });
prompt.once('run', () => { int = setInterval(() => { if (time-- === 0) { prompt.state.input = ''; prompt.cancel(); } else { prompt.render(); } }, 1000); });
startChild() { let worker = new Worker(this.options); worker.fork(this.options.workerPath, this.bundlerOptions); worker.on("request", data => this.processRequest(data, worker)); worker.on("ready", () => this.processQueue()); worker.on("response", () => this.processQueue()); worker.on("error", err => this.onError(err, worker)); worker.once("exit", () => this.stopWorker(worker)); this.workers.set(worker.id, worker); }