@@ -3,6 +3,7 @@ import os from "node:os";
33import path from "node:path" ;
44import { pathToFileURL } from "node:url" ;
55import { afterAll , afterEach , beforeAll , describe , expect , it , vi } from "vitest" ;
6+ import YAML from "yaml" ;
67import type { CommandOptions } from "../process/exec.js" ;
78import { createSuiteTempRootTracker } from "../test-helpers/temp-dir.js" ;
89import {
@@ -232,11 +233,11 @@ describe("managed npm root", () => {
232233 } ) ;
233234 } ) ;
234235
235- it ( "reads package-level npm overrides for managed plugin installs" , async ( ) => {
236- const manifest = JSON . parse (
237- await fs . readFile ( path . resolve ( process . cwd ( ) , "package.json " ) , "utf8" ) ,
236+ it ( "reads workspace pnpm overrides for managed plugin installs" , async ( ) => {
237+ const workspace = YAML . parse (
238+ await fs . readFile ( path . resolve ( process . cwd ( ) , "pnpm-workspace.yaml " ) , "utf8" ) ,
238239 ) as { overrides ?: Record < string , unknown > } ;
239- const expectedOverrides = manifest . overrides ?? { } ;
240+ const expectedOverrides = workspace . overrides ?? { } ;
240241
241242 expect ( expectedOverrides ) . toMatchObject ( {
242243 axios : "1.16.0" ,
@@ -245,22 +246,23 @@ describe("managed npm root", () => {
245246 await expect ( readOpenClawManagedNpmRootOverrides ( ) ) . resolves . toEqual ( expectedOverrides ) ;
246247 } ) ;
247248
248- it ( "resolves package-level npm overrides from packaged dist chunks" , async ( ) => {
249+ it ( "resolves workspace pnpm overrides from packaged dist chunks" , async ( ) => {
249250 const packageRoot = await makeTempRoot ( ) ;
250251 await fs . mkdir ( path . join ( packageRoot , "dist" ) , { recursive : true } ) ;
251252 await fs . writeFile (
252253 path . join ( packageRoot , "package.json" ) ,
253254 `${ JSON . stringify (
254255 {
255256 name : "openclaw" ,
256- overrides : {
257- axios : "1.16.0" ,
258- } ,
259257 } ,
260258 null ,
261259 2 ,
262260 ) } \n`,
263261 ) ;
262+ await fs . writeFile (
263+ path . join ( packageRoot , "pnpm-workspace.yaml" ) ,
264+ "overrides:\n axios: 1.16.0\n" ,
265+ ) ;
264266
265267 await expect (
266268 readOpenClawManagedNpmRootOverrides ( {
@@ -286,20 +288,24 @@ describe("managed npm root", () => {
286288 optionalDependencies : {
287289 "optional-runtime" : "2.0.0" ,
288290 } ,
289- overrides : {
290- "managed-runtime" : "$managed-runtime" ,
291- nested : {
292- "optional-runtime" : "$optional-runtime" ,
293- alias : "$node-domexception" ,
294- } ,
295- axios : "1.16.0" ,
296- "node-domexception" : "$node-domexception" ,
297- } ,
298291 } ,
299292 null ,
300293 2 ,
301294 ) } \n`,
302295 ) ;
296+ await fs . writeFile (
297+ path . join ( packageRoot , "pnpm-workspace.yaml" ) ,
298+ [
299+ "overrides:" ,
300+ ' managed-runtime: "$managed-runtime"' ,
301+ " nested:" ,
302+ ' optional-runtime: "$optional-runtime"' ,
303+ ' alias: "$node-domexception"' ,
304+ " axios: 1.16.0" ,
305+ ' node-domexception: "$node-domexception"' ,
306+ "" ,
307+ ] . join ( "\n" ) ,
308+ ) ;
303309
304310 await expect ( readOpenClawManagedNpmRootOverrides ( { packageRoot } ) ) . resolves . toEqual ( {
305311 "managed-runtime" : "3.1024.0" ,
0 commit comments