From 3243b7103e5fbe77ae6eb76531e8d41dda8d0c41 Mon Sep 17 00:00:00 2001 From: Andrew Haines Date: Tue, 7 May 2024 18:43:01 +0100 Subject: [PATCH] Support file URLs when configuring multiple transports (#1961) --- lib/transport-stream.js | 2 +- test/transport/core.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/transport-stream.js b/lib/transport-stream.js index b152fc9ff..da864a9b7 100644 --- a/lib/transport-stream.js +++ b/lib/transport-stream.js @@ -13,7 +13,7 @@ module.exports = loadTransportStreamBuilder async function loadTransportStreamBuilder (target) { let fn try { - const toLoad = 'file://' + target + const toLoad = target.startsWith('file://') ? target : 'file://' + target if (toLoad.endsWith('.ts') || toLoad.endsWith('.cts')) { // TODO: add support for the TSM modules loader ( https://github.com/lukeed/tsm ). diff --git a/test/transport/core.test.js b/test/transport/core.test.js index ee5ef107c..b8af6738d 100644 --- a/test/transport/core.test.js +++ b/test/transport/core.test.js @@ -134,7 +134,7 @@ test('pino.transport with two files', async ({ same, teardown }) => { const transport = pino.transport({ targets: [{ level: 'info', - target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + target: 'file://' + join(__dirname, '..', 'fixtures', 'to-file-transport.js'), options: { destination: dest1 } }, { level: 'info',