Files
klz-cables.com/.pnpm-store/v10/files/48/bc0b3c2614211a030851aee736f37501755cc226acb854d7471cfa87be79d54eed8b538ff5e104181d4d4fe38d1fae34f14149dc0c88ba5630e6ebdec972d3
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

56 lines
1.3 KiB
Plaintext

'use strict'
const pino = require('../..')
const { join } = require('node:path')
const { readFileSync } = require('node:fs')
const { test } = require('tap')
const { file } = require('../helper')
test('thread-stream sync true should log synchronously', async (t) => {
const outputPath = file()
function getOutputLogLines () {
return (readFileSync(outputPath)).toString().trim().split('\n').map(JSON.parse)
}
const transport = pino.transport({
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
options: { destination: outputPath, flush: true },
sync: true
})
const instance = pino(transport)
var value = { message: 'sync' }
instance.info(value)
instance.info(value)
instance.info(value)
instance.info(value)
instance.info(value)
instance.info(value)
let interrupt = false
let flushData
let loopCounter = 0
// Start a synchronous loop
while (!interrupt && loopCounter < (process.env.MAX_TEST_LOOP_ITERATION || 20000)) {
try {
loopCounter++
const data = getOutputLogLines()
flushData = data
if (data) {
interrupt = true
break
}
} catch (error) {
// File may not exist yet
// Wait till MAX_TEST_LOOP_ITERATION iterations
}
}
if (!interrupt) {
throw new Error('Sync loop did not get interrupt')
}
t.equal(flushData.length, 6)
})