@@ -3,6 +3,7 @@ import crypto from "node:crypto";
33import fs from "node:fs" ;
44import path from "node:path" ;
55import { fileURLToPath } from "node:url" ;
6+ import util from "node:util" ;
67import { getTodaysCompatDate } from "@cloudflare/workers-utils" ;
78import * as devalue from "devalue" ;
89import getPort , { portNumbers } from "get-port" ;
@@ -66,8 +67,10 @@ export function structuredSerializableParse(value: string): unknown {
6667 return devalue . parse ( value , structuredSerializableRevivers ) ;
6768}
6869
69- // Log for informational pool messages
70- const log = new Log ( LogLevel . VERBOSE , { prefix : "vpw" } ) ;
70+ // Log for pool info/warnings/errors (user-actionable messages only)
71+ const log = new Log ( LogLevel . INFO , { prefix : "vpw" } ) ;
72+ // Debug log gated behind NODE_DEBUG=vitest-pool-workers
73+ const debug = util . debuglog ( "vitest-pool-workers" ) ;
7174// Log for Miniflare instances, used for user code warnings/errors
7275const mfLog = new Log ( LogLevel . WARN ) ;
7376
@@ -312,10 +315,10 @@ async function buildProjectWorkerOptions(
312315 if ( runnerWorker . compatibilityDate === undefined ) {
313316 // No compatibility date was provided, so use today's date
314317 runnerWorker . compatibilityDate = getTodaysCompatDate ( ) ;
315- log . info (
316- ` No compatibility date was provided for project ${ getRelativeProjectPath (
317- project
318- ) } , defaulting to today's date ${ runnerWorker . compatibilityDate } .`
318+ debug (
319+ " No compatibility date was provided for project %s, defaulting to today's date %s." ,
320+ getRelativeProjectPath ( project ) ,
321+ runnerWorker . compatibilityDate
319322 ) ;
320323 }
321324
@@ -659,15 +662,12 @@ export async function getProjectMiniflare(
659662 poolOptions ,
660663 main
661664 ) ;
662- log . info (
663- `Starting runtime for ${ getRelativeProjectPath ( project ) } ` +
664- `${
665- mfOptions . inspectorPort !== undefined
666- ? ` with inspector on port ${ mfOptions . inspectorPort } `
667- : ""
668- } ` +
669- `...`
670- ) ;
665+ debug ( "Starting runtime for %s..." , getRelativeProjectPath ( project ) ) ;
666+ if ( mfOptions . inspectorPort !== undefined ) {
667+ log . info (
668+ `Starting inspector on port ${ mfOptions . inspectorPort } for ${ getRelativeProjectPath ( project ) } `
669+ ) ;
670+ }
671671 const mf = new Miniflare ( mfOptions ) ;
672672 await mf . ready ;
673673 return mf ;
@@ -812,13 +812,14 @@ function ensureFeature(compatibilityFlags: string[], feature: string) {
812812 const flagToEnable = `enable_${ feature } ` ;
813813 const flagToDisable = `disable_${ feature } ` ;
814814 if ( ! compatibilityFlags . includes ( flagToEnable ) ) {
815- log . debug (
816- `Adding \`${ flagToEnable } \` compatibility flag during tests as this feature is needed to support the Vitest runner.`
815+ debug (
816+ "Adding `%s` compatibility flag during tests as this feature is needed to support the Vitest runner." ,
817+ flagToEnable
817818 ) ;
818819 compatibilityFlags . push ( flagToEnable ) ;
819820 }
820821 if ( compatibilityFlags . includes ( flagToDisable ) ) {
821- log . info (
822+ log . warn (
822823 `Removing \`${ flagToDisable } \` compatibility flag during tests as that feature is needed to support the Vitest runner.`
823824 ) ;
824825 compatibilityFlags . splice ( compatibilityFlags . indexOf ( flagToDisable ) , 1 ) ;
0 commit comments