Skip to content

Commit 2cb97aa

Browse files
committed
fix: replace import.meta.dirname with Node 20-compatible fileURLToPath
import.meta.dirname was added in Node 21.2.0 and is not available on Node 20.x. Replace with the standard dirname(fileURLToPath(import.meta.url)) pattern so CI passes on both 20.x and 22.x matrix entries. https://claude.ai/code/session_01EXcoDfR7Hvoobx8aNBdE67
1 parent 3870c3c commit 2cb97aa

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/claude-code/test/init.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { describe, it, expect } from "vitest";
22
import { spawnSync, type SpawnSyncReturns } from "node:child_process";
33
import { mkdtempSync, readFileSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
44
import { tmpdir } from "node:os";
5-
import { join, resolve } from "node:path";
5+
import { join, resolve, dirname } from "node:path";
6+
import { fileURLToPath } from "node:url";
67

7-
const BIN = resolve(import.meta.dirname, "../bin/init.js");
8+
const BIN = resolve(dirname(fileURLToPath(import.meta.url)), "../bin/init.js");
89

910
function run(args: string[], env?: Record<string, string>): SpawnSyncReturns<string> {
1011
return spawnSync(process.execPath, [BIN, ...args], {

0 commit comments

Comments
 (0)