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/../querystring/../@protobufjs/../once/../wrap-ansi/../statuses/../punycode/../socket.io-parser/../pino/test/esm/.
الملفات الموجودة في هذا الـ Path:
.
..
esm.mjs
index.test.js
named-exports.mjs

مشاهدة ملف: named-exports.mjs

import { tmpdir, hostname } from 'os'
import t from 'tap'
import { sink, check, once, watchFileCreated, file } from '../helper.js'
import { pino, destination } from '../../pino.js'
import { join } from 'path'
import { readFileSync } from 'fs'

t.test('named exports support', async ({ equal }) => {
  const stream = sink()
  const instance = pino(stream)
  instance.info('hello world')
  check(equal, await once(stream, 'data'), 30, 'hello world')
})

t.test('destination', async ({ same }) => {
  const tmp = file()
  const instance = pino(destination(tmp))
  instance.info('hello')
  await watchFileCreated(tmp)
  const result = JSON.parse(readFileSync(tmp).toString())
  delete result.time
  same(result, {
    pid: process.pid,
    hostname,
    level: 30,
    msg: 'hello'
  })
})