From 690fde711e0f2bc4e5418534c02f560e5e78d1f4 Mon Sep 17 00:00:00 2001 From: adstep Date: Tue, 13 Oct 2026 18:42:38 -0700 Subject: [PATCH] benchmarks: resolve paths with import.meta.dirname so the suite runs on Windows Copilot-Session: 57346a82-6880-4206-9552-9105be00e3e7 --- benchmarks/src/cluster.js | 3 ++- benchmarks/src/index.js | 3 ++- benchmarks/src/suites/y1-primitives.js | 3 ++- benchmarks/src/trace.js | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/benchmarks/src/cluster.js b/benchmarks/src/cluster.js index 4e30acb..1eb51cc 100644 --- a/benchmarks/src/cluster.js +++ b/benchmarks/src/cluster.js @@ -1,4 +1,5 @@ import { fork } from 'node:child_process' +import * as path from 'node:path' import { createClient } from 'redis' import postgres from 'postgres' import * as promise from 'lib0/promise' @@ -14,7 +15,7 @@ import { sumProcessMetrics } from './metrics.js' * so a full sweep does not pay a boot per row. */ -const hubEntry = new URL('./proc/hub.js', import.meta.url).pathname +const hubEntry = path.join(import.meta.dirname, 'proc/hub.js') /** * @param {any} child diff --git a/benchmarks/src/index.js b/benchmarks/src/index.js index f0e89dc..1f5e610 100644 --- a/benchmarks/src/index.js +++ b/benchmarks/src/index.js @@ -1,3 +1,4 @@ +import * as path from 'node:path' import config from './config.js' import { Reporter, freeDiskGiB } from './report.js' import { stopCluster, reclaimStorage, takeTaskFailures } from './cluster.js' @@ -89,7 +90,7 @@ const run = async () => { } } await stopCluster() - const outPath = new URL('../' + config.run.outFile, import.meta.url).pathname + const outPath = path.join(import.meta.dirname, '..', config.run.outFile) report.write(outPath, derivedSection(report)) } diff --git a/benchmarks/src/suites/y1-primitives.js b/benchmarks/src/suites/y1-primitives.js index bae5c61..5e7f55b 100644 --- a/benchmarks/src/suites/y1-primitives.js +++ b/benchmarks/src/suites/y1-primitives.js @@ -1,4 +1,5 @@ import { fork } from 'node:child_process' +import * as path from 'node:path' import * as Y from '@y/y' import * as promise from 'lib0/promise' import { mergeUpdates } from '../../../src/y-utils.js' @@ -91,7 +92,7 @@ export const runY14 = () => { * cannot be made inside one process. */ const runNative = () => promise.create((resolve, reject) => { - const child = fork(new URL('../proc/y-native.js', import.meta.url).pathname, [], { + const child = fork(path.join(import.meta.dirname, '../proc/y-native.js'), [], { env: { ...process.env, USE_Y_NATIVE: '1' }, execArgv: ['--expose-gc', '--max-old-space-size=8192'], stdio: ['ignore', 'inherit', 'inherit', 'ipc'] diff --git a/benchmarks/src/trace.js b/benchmarks/src/trace.js index 4dcd223..e5b2681 100644 --- a/benchmarks/src/trace.js +++ b/benchmarks/src/trace.js @@ -1,4 +1,5 @@ import * as fs from 'node:fs' +import * as path from 'node:path' import * as decoding from 'lib0/decoding' import config from './config.js' @@ -19,7 +20,7 @@ import config from './config.js' * @typedef {{ type: string, updateFormat: string, gc: boolean, source: any, users: Array, totalBytes: number, updates: Array }} Trace */ -const tracePath = new URL(`../${config.trace.file}`, import.meta.url).pathname +const tracePath = path.join(import.meta.dirname, '..', config.trace.file) export const traceAvailable = () => fs.existsSync(tracePath)