Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../uploads/../../../../instantly.picotech.app/homes/../../wa.picotech.app/public_html/node_modules/escape-html/../././form-data/../has-proto/../cache-manager/../split2/../@tokenizer/../socket.io/../pino/test
الملفات الموجودة في هذا الـ Path:
.
..
basic.test.js
broken-pipe.test.js
browser-levels.test.js
browser-serializers.test.js
browser-timestamp.test.js
browser-transmit.test.js
browser.test.js
complex-objects.test.js
crlf.test.js
custom-levels.test.js
error.test.js
escaping.test.js
esm
exit.test.js
final.test.js
fixtures
formatters.test.js
helper.d.ts
helper.js
hooks.test.js
http.test.js
is-level-enabled.test.js
jest
levels.test.js
metadata.test.js
mixin-merge-strategy.test.js
mixin.test.js
multistream.test.js
pretty.test.js
redact.test.js
serializers.test.js
stdout-protection.test.js
syncfalse.test.js
timestamp.test.js
transport
types

مشاهدة ملف: exit.test.js

'use strict'

const { test } = require('tap')
const { join } = require('path')
const execa = require('execa')
const writer = require('flush-write-stream')
const { once } = require('./helper')

// https://github.com/pinojs/pino/issues/542
test('pino.destination log everything when calling process.exit(0)', async ({ not }) => {
  let actual = ''
  const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'destination-exit.js')])

  child.stdout.pipe(writer((s, enc, cb) => {
    actual += s
    cb()
  }))

  await once(child, 'close')

  not(actual.match(/hello/), null)
  not(actual.match(/world/), null)
})

test('pino with no args log everything when calling process.exit(0)', async ({ not }) => {
  let actual = ''
  const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'default-exit.js')])

  child.stdout.pipe(writer((s, enc, cb) => {
    actual += s
    cb()
  }))

  await once(child, 'close')

  not(actual.match(/hello/), null)
  not(actual.match(/world/), null)
})

const hasWeak = !!global.WeakRef

test('sync false does not log everything when calling process.exit(0)', { skip: hasWeak }, async ({ equal }) => {
  let actual = ''
  const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'syncfalse-exit.js')])

  child.stdout.pipe(writer((s, enc, cb) => {
    actual += s
    cb()
  }))

  await once(child, 'close')

  equal(actual.match(/hello/), null)
  equal(actual.match(/world/), null)
})

test('sync false logs everything when calling process.exit(0)', { skip: !hasWeak }, async ({ not }) => {
  let actual = ''
  const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'syncfalse-exit.js')])

  child.stdout.pipe(writer((s, enc, cb) => {
    actual += s
    cb()
  }))

  await once(child, 'close')

  not(actual.match(/hello/), null)
  not(actual.match(/world/), null)
})

test('sync false logs everything when calling flushSync', async ({ not }) => {
  let actual = ''
  const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'syncfalse-flush-exit.js')])

  child.stdout.pipe(writer((s, enc, cb) => {
    actual += s
    cb()
  }))

  await once(child, 'close')

  not(actual.match(/hello/), null)
  not(actual.match(/world/), null)
})