isolate-package 1.30.0-0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
2
- import type { PackageManifest } from "~/lib/types";
2
+ import type { PackageManifest, PnpmSettings } from "~/lib/types";
3
3
  import { copyPatches } from "./copy-patches";
4
4
 
5
5
  /** Mock fs-extra */
@@ -18,11 +18,12 @@ vi.mock("~/lib/utils", () => ({
18
18
  getRootRelativeLogPath: vi.fn((p: string) => p),
19
19
  isRushWorkspace: vi.fn(() => false),
20
20
  readTypedJson: vi.fn(),
21
+ readTypedYamlSync: vi.fn(),
21
22
  }));
22
23
 
23
24
  /** Mock the package manager */
24
25
  vi.mock("~/lib/package-manager", () => ({
25
- usePackageManager: vi.fn(() => ({ majorVersion: 9 })),
26
+ usePackageManager: vi.fn(() => ({ name: "pnpm", majorVersion: 9 })),
26
27
  }));
27
28
 
28
29
  /** Mock the pnpm lockfile readers */
@@ -35,9 +36,9 @@ vi.mock("pnpm_lockfile_file_v9", () => ({
35
36
  }));
36
37
 
37
38
  const fs = vi.mocked((await import("fs-extra")).default);
38
- const { filterPatchedDependencies, readTypedJson } = vi.mocked(
39
- await import("~/lib/utils"),
40
- );
39
+ const { filterPatchedDependencies, readTypedJson, readTypedYamlSync } =
40
+ vi.mocked(await import("~/lib/utils"));
41
+ const { usePackageManager } = vi.mocked(await import("~/lib/package-manager"));
41
42
 
42
43
  describe("copyPatches", () => {
43
44
  beforeEach(() => {
@@ -48,46 +49,19 @@ describe("copyPatches", () => {
48
49
  vi.restoreAllMocks();
49
50
  });
50
51
 
51
- it("should return empty object when workspace root package.json cannot be read", async () => {
52
- readTypedJson.mockRejectedValue(new Error("File not found"));
53
-
54
- const result = await copyPatches({
55
- workspaceRootDir: "/workspace",
56
- targetPackageManifest: { name: "test", version: "1.0.0" },
57
- isolateDir: "/workspace/isolate",
58
- includeDevDependencies: false,
59
- });
60
-
61
- expect(result).toEqual({});
62
- });
63
-
64
- it("should return empty object when no patchedDependencies in workspace root", async () => {
52
+ const mockJsonSettings = (settings: PnpmSettings | undefined) => {
65
53
  readTypedJson.mockResolvedValue({
66
54
  name: "root",
67
55
  version: "1.0.0",
68
- } as PackageManifest);
69
-
70
- const result = await copyPatches({
71
- workspaceRootDir: "/workspace",
72
- targetPackageManifest: { name: "test", version: "1.0.0" },
73
- isolateDir: "/workspace/isolate",
74
- includeDevDependencies: false,
56
+ pnpm: settings,
75
57
  });
58
+ };
76
59
 
77
- expect(result).toEqual({});
78
- });
79
-
80
- it("should return empty object when all patches are filtered out", async () => {
81
- readTypedJson.mockResolvedValue({
82
- name: "root",
83
- version: "1.0.0",
84
- pnpm: {
85
- patchedDependencies: {
86
- "lodash@4.17.21": "patches/lodash.patch",
87
- },
88
- },
89
- } as PackageManifest);
90
- filterPatchedDependencies.mockReturnValue(undefined);
60
+ it("should return empty object when workspace root package.json cannot be read", async () => {
61
+ readTypedYamlSync.mockImplementation(() => {
62
+ throw new Error("File not found");
63
+ });
64
+ readTypedJson.mockRejectedValue(new Error("File not found"));
91
65
 
92
66
  const result = await copyPatches({
93
67
  workspaceRootDir: "/workspace",
@@ -99,275 +73,372 @@ describe("copyPatches", () => {
99
73
  expect(result).toEqual({});
100
74
  });
101
75
 
102
- it("should copy patches for production dependencies", async () => {
103
- const targetManifest: PackageManifest = {
104
- name: "test",
105
- version: "1.0.0",
106
- dependencies: { lodash: "^4.0.0" },
76
+ // Repeat these tests for each combination of config formats
77
+ describe.for([
78
+ "yamlOnly",
79
+ "yamlAndJson",
80
+ "jsonYamlEmpty",
81
+ "jsonYamlError",
82
+ ] as const)("valid config tests: %s", (mode) => {
83
+ // Helper to set up mocks for the correct manifest file for this test scenario
84
+ const mockManifest = (settings: PnpmSettings | undefined) => {
85
+ switch (mode) {
86
+ case "yamlOnly": {
87
+ readTypedYamlSync.mockReturnValue(settings ?? {});
88
+ readTypedJson.mockResolvedValue({ name: "test", version: "1.0.0" });
89
+ break;
90
+ }
91
+ case "yamlAndJson": {
92
+ readTypedYamlSync.mockReturnValue(settings ?? {});
93
+ readTypedJson.mockResolvedValue({
94
+ name: "test",
95
+ version: "1.0.0",
96
+ pnpm: settings,
97
+ });
98
+ break;
99
+ }
100
+ case "jsonYamlEmpty": {
101
+ readTypedYamlSync.mockReturnValue({});
102
+ readTypedJson.mockResolvedValue({
103
+ name: "test",
104
+ version: "1.0.0",
105
+ pnpm: settings,
106
+ });
107
+ break;
108
+ }
109
+ case "jsonYamlError": {
110
+ readTypedYamlSync.mockImplementation(() => {
111
+ throw new Error("File not found");
112
+ });
113
+ readTypedJson.mockResolvedValue({
114
+ name: "test",
115
+ version: "1.0.0",
116
+ pnpm: settings,
117
+ });
118
+ break;
119
+ }
120
+ }
107
121
  };
108
122
 
109
- readTypedJson.mockResolvedValue({
110
- name: "root",
111
- version: "1.0.0",
112
- pnpm: {
123
+ it("should return empty object when no patchedDependencies in workspace root", async () => {
124
+ mockManifest(undefined);
125
+
126
+ const result = await copyPatches({
127
+ workspaceRootDir: "/workspace",
128
+ targetPackageManifest: { name: "test", version: "1.0.0" },
129
+ isolateDir: "/workspace/isolate",
130
+ includeDevDependencies: false,
131
+ });
132
+
133
+ expect(result).toEqual({});
134
+ });
135
+
136
+ it("should return empty object when all patches are filtered out", async () => {
137
+ mockManifest({
113
138
  patchedDependencies: {
114
139
  "lodash@4.17.21": "patches/lodash.patch",
115
140
  },
116
- },
117
- } as PackageManifest);
118
-
119
- filterPatchedDependencies.mockReturnValue({
120
- "lodash@4.17.21": "patches/lodash.patch",
121
- });
141
+ });
122
142
 
123
- fs.existsSync.mockReturnValue(true);
143
+ filterPatchedDependencies.mockReturnValue(undefined);
124
144
 
125
- const result = await copyPatches({
126
- workspaceRootDir: "/workspace",
127
- targetPackageManifest: targetManifest,
128
- isolateDir: "/workspace/isolate",
129
- includeDevDependencies: false,
130
- });
145
+ const result = await copyPatches({
146
+ workspaceRootDir: "/workspace",
147
+ targetPackageManifest: { name: "test", version: "1.0.0" },
148
+ isolateDir: "/workspace/isolate",
149
+ includeDevDependencies: false,
150
+ });
131
151
 
132
- expect(result).toEqual({
133
- "lodash@4.17.21": { path: "patches/lodash.patch", hash: "" },
152
+ expect(result).toEqual({});
134
153
  });
135
- /** Should preserve original folder structure */
136
- expect(fs.ensureDir).toHaveBeenCalledWith("/workspace/isolate/patches");
137
- expect(fs.copy).toHaveBeenCalledWith(
138
- "/workspace/patches/lodash.patch",
139
- "/workspace/isolate/patches/lodash.patch",
140
- );
141
- });
142
154
 
143
- it("should include dev dependency patches when includeDevDependencies is true", async () => {
144
- const targetManifest: PackageManifest = {
145
- name: "test",
146
- version: "1.0.0",
147
- devDependencies: { vitest: "^1.0.0" },
148
- };
155
+ it("should copy patches for production dependencies", async () => {
156
+ const targetManifest: PackageManifest = {
157
+ name: "test",
158
+ version: "1.0.0",
159
+ dependencies: { lodash: "^4.0.0" },
160
+ };
149
161
 
150
- readTypedJson.mockResolvedValue({
151
- name: "root",
152
- version: "1.0.0",
153
- pnpm: {
162
+ mockManifest({
154
163
  patchedDependencies: {
155
- "vitest@1.0.0": "patches/vitest.patch",
164
+ "lodash@4.17.21": "patches/lodash.patch",
156
165
  },
157
- },
158
- } as PackageManifest);
159
-
160
- filterPatchedDependencies.mockReturnValue({
161
- "vitest@1.0.0": "patches/vitest.patch",
166
+ });
167
+
168
+ filterPatchedDependencies.mockReturnValue({
169
+ "lodash@4.17.21": "patches/lodash.patch",
170
+ });
171
+
172
+ fs.existsSync.mockReturnValue(true);
173
+
174
+ const result = await copyPatches({
175
+ workspaceRootDir: "/workspace",
176
+ targetPackageManifest: targetManifest,
177
+ isolateDir: "/workspace/isolate",
178
+ includeDevDependencies: false,
179
+ });
180
+
181
+ expect(result).toEqual({
182
+ "lodash@4.17.21": { path: "patches/lodash.patch", hash: "" },
183
+ });
184
+ /** Should preserve original folder structure */
185
+ expect(fs.ensureDir).toHaveBeenCalledWith("/workspace/isolate/patches");
186
+ expect(fs.copy).toHaveBeenCalledWith(
187
+ "/workspace/patches/lodash.patch",
188
+ "/workspace/isolate/patches/lodash.patch",
189
+ );
162
190
  });
163
191
 
164
- fs.existsSync.mockReturnValue(true);
192
+ it("should include dev dependency patches when includeDevDependencies is true", async () => {
193
+ const targetManifest: PackageManifest = {
194
+ name: "test",
195
+ version: "1.0.0",
196
+ devDependencies: { vitest: "^1.0.0" },
197
+ };
165
198
 
166
- const result = await copyPatches({
167
- workspaceRootDir: "/workspace",
168
- targetPackageManifest: targetManifest,
169
- isolateDir: "/workspace/isolate",
170
- includeDevDependencies: true,
171
- });
172
-
173
- expect(result).toEqual({
174
- "vitest@1.0.0": { path: "patches/vitest.patch", hash: "" },
175
- });
176
- expect(filterPatchedDependencies).toHaveBeenCalledWith({
177
- patchedDependencies: { "vitest@1.0.0": "patches/vitest.patch" },
178
- targetPackageManifest: targetManifest,
179
- includeDevDependencies: true,
199
+ mockManifest({
200
+ patchedDependencies: {
201
+ "vitest@1.0.0": "patches/vitest.patch",
202
+ },
203
+ });
204
+
205
+ filterPatchedDependencies.mockReturnValue({
206
+ "vitest@1.0.0": "patches/vitest.patch",
207
+ });
208
+
209
+ fs.existsSync.mockReturnValue(true);
210
+
211
+ const result = await copyPatches({
212
+ workspaceRootDir: "/workspace",
213
+ targetPackageManifest: targetManifest,
214
+ isolateDir: "/workspace/isolate",
215
+ includeDevDependencies: true,
216
+ });
217
+
218
+ expect(result).toEqual({
219
+ "vitest@1.0.0": { path: "patches/vitest.patch", hash: "" },
220
+ });
221
+ expect(filterPatchedDependencies).toHaveBeenCalledWith({
222
+ patchedDependencies: { "vitest@1.0.0": "patches/vitest.patch" },
223
+ targetPackageManifest: targetManifest,
224
+ includeDevDependencies: true,
225
+ });
226
+ expect(fs.copy).toHaveBeenCalledWith(
227
+ "/workspace/patches/vitest.patch",
228
+ "/workspace/isolate/patches/vitest.patch",
229
+ );
180
230
  });
181
- expect(fs.copy).toHaveBeenCalledWith(
182
- "/workspace/patches/vitest.patch",
183
- "/workspace/isolate/patches/vitest.patch",
184
- );
185
- });
186
231
 
187
- it("should skip missing patch files and log a warning", async () => {
188
- const targetManifest: PackageManifest = {
189
- name: "test",
190
- version: "1.0.0",
191
- dependencies: { lodash: "^4.0.0" },
192
- };
232
+ it("should skip missing patch files and log a warning", async () => {
233
+ const targetManifest: PackageManifest = {
234
+ name: "test",
235
+ version: "1.0.0",
236
+ dependencies: { lodash: "^4.0.0" },
237
+ };
193
238
 
194
- readTypedJson.mockResolvedValue({
195
- name: "root",
196
- version: "1.0.0",
197
- pnpm: {
239
+ mockManifest({
198
240
  patchedDependencies: {
199
241
  "lodash@4.17.21": "patches/lodash.patch",
200
242
  },
201
- },
202
- } as PackageManifest);
243
+ });
203
244
 
204
- filterPatchedDependencies.mockReturnValue({
205
- "lodash@4.17.21": "patches/lodash.patch",
206
- });
245
+ filterPatchedDependencies.mockReturnValue({
246
+ "lodash@4.17.21": "patches/lodash.patch",
247
+ });
207
248
 
208
- fs.existsSync.mockReturnValue(false);
249
+ fs.existsSync.mockReturnValue(false);
209
250
 
210
- const result = await copyPatches({
211
- workspaceRootDir: "/workspace",
212
- targetPackageManifest: targetManifest,
213
- isolateDir: "/workspace/isolate",
214
- includeDevDependencies: false,
215
- });
251
+ const result = await copyPatches({
252
+ workspaceRootDir: "/workspace",
253
+ targetPackageManifest: targetManifest,
254
+ isolateDir: "/workspace/isolate",
255
+ includeDevDependencies: false,
256
+ });
216
257
 
217
- expect(result).toEqual({});
218
- expect(fs.copy).not.toHaveBeenCalled();
219
- });
258
+ expect(result).toEqual({});
259
+ expect(fs.copy).not.toHaveBeenCalled();
260
+ });
220
261
 
221
- it("should handle scoped package names correctly", async () => {
222
- const targetManifest: PackageManifest = {
223
- name: "test",
224
- version: "1.0.0",
225
- dependencies: { "@firebase/app": "^1.0.0" },
226
- };
262
+ it("should handle scoped package names correctly", async () => {
263
+ const targetManifest: PackageManifest = {
264
+ name: "test",
265
+ version: "1.0.0",
266
+ dependencies: { "@firebase/app": "^1.0.0" },
267
+ };
227
268
 
228
- readTypedJson.mockResolvedValue({
229
- name: "root",
230
- version: "1.0.0",
231
- pnpm: {
269
+ mockManifest({
232
270
  patchedDependencies: {
233
271
  "@firebase/app@1.2.3": "patches/firebase-app.patch",
234
272
  },
235
- },
236
- } as PackageManifest);
273
+ });
237
274
 
238
- filterPatchedDependencies.mockReturnValue({
239
- "@firebase/app@1.2.3": "patches/firebase-app.patch",
240
- });
275
+ filterPatchedDependencies.mockReturnValue({
276
+ "@firebase/app@1.2.3": "patches/firebase-app.patch",
277
+ });
241
278
 
242
- fs.existsSync.mockReturnValue(true);
279
+ fs.existsSync.mockReturnValue(true);
243
280
 
244
- const result = await copyPatches({
245
- workspaceRootDir: "/workspace",
246
- targetPackageManifest: targetManifest,
247
- isolateDir: "/workspace/isolate",
248
- includeDevDependencies: false,
249
- });
281
+ const result = await copyPatches({
282
+ workspaceRootDir: "/workspace",
283
+ targetPackageManifest: targetManifest,
284
+ isolateDir: "/workspace/isolate",
285
+ includeDevDependencies: false,
286
+ });
250
287
 
251
- expect(result).toEqual({
252
- "@firebase/app@1.2.3": { path: "patches/firebase-app.patch", hash: "" },
288
+ expect(result).toEqual({
289
+ "@firebase/app@1.2.3": { path: "patches/firebase-app.patch", hash: "" },
290
+ });
253
291
  });
254
- });
255
292
 
256
- it("should preserve nested folder structure when copying patches", async () => {
257
- const targetManifest: PackageManifest = {
258
- name: "test",
259
- version: "1.0.0",
260
- dependencies: { "pkg-a": "^1.0.0", "pkg-b": "^1.0.0" },
261
- };
293
+ it("should preserve nested folder structure when copying patches", async () => {
294
+ const targetManifest: PackageManifest = {
295
+ name: "test",
296
+ version: "1.0.0",
297
+ dependencies: { "pkg-a": "^1.0.0", "pkg-b": "^1.0.0" },
298
+ };
262
299
 
263
- readTypedJson.mockResolvedValue({
264
- name: "root",
265
- version: "1.0.0",
266
- pnpm: {
300
+ mockManifest({
267
301
  patchedDependencies: {
268
302
  "pkg-a@1.0.0": "patches/v1/fix.patch",
269
303
  "pkg-b@1.0.0": "patches/v2/fix.patch",
270
304
  },
271
- },
272
- } as PackageManifest);
273
-
274
- filterPatchedDependencies.mockReturnValue({
275
- "pkg-a@1.0.0": "patches/v1/fix.patch",
276
- "pkg-b@1.0.0": "patches/v2/fix.patch",
277
- });
278
-
279
- fs.existsSync.mockReturnValue(true);
280
-
281
- const result = await copyPatches({
282
- workspaceRootDir: "/workspace",
283
- targetPackageManifest: targetManifest,
284
- isolateDir: "/workspace/isolate",
285
- includeDevDependencies: false,
305
+ });
306
+
307
+ filterPatchedDependencies.mockReturnValue({
308
+ "pkg-a@1.0.0": "patches/v1/fix.patch",
309
+ "pkg-b@1.0.0": "patches/v2/fix.patch",
310
+ });
311
+
312
+ fs.existsSync.mockReturnValue(true);
313
+
314
+ const result = await copyPatches({
315
+ workspaceRootDir: "/workspace",
316
+ targetPackageManifest: targetManifest,
317
+ isolateDir: "/workspace/isolate",
318
+ includeDevDependencies: false,
319
+ });
320
+
321
+ /** Should preserve original paths without renaming */
322
+ expect(result).toEqual({
323
+ "pkg-a@1.0.0": { path: "patches/v1/fix.patch", hash: "" },
324
+ "pkg-b@1.0.0": { path: "patches/v2/fix.patch", hash: "" },
325
+ });
326
+ expect(fs.copy).toHaveBeenCalledTimes(2);
327
+ expect(fs.copy).toHaveBeenCalledWith(
328
+ "/workspace/patches/v1/fix.patch",
329
+ "/workspace/isolate/patches/v1/fix.patch",
330
+ );
331
+ expect(fs.copy).toHaveBeenCalledWith(
332
+ "/workspace/patches/v2/fix.patch",
333
+ "/workspace/isolate/patches/v2/fix.patch",
334
+ );
286
335
  });
287
336
 
288
- /** Should preserve original paths without renaming */
289
- expect(result).toEqual({
290
- "pkg-a@1.0.0": { path: "patches/v1/fix.patch", hash: "" },
291
- "pkg-b@1.0.0": { path: "patches/v2/fix.patch", hash: "" },
292
- });
293
- expect(fs.copy).toHaveBeenCalledTimes(2);
294
- expect(fs.copy).toHaveBeenCalledWith(
295
- "/workspace/patches/v1/fix.patch",
296
- "/workspace/isolate/patches/v1/fix.patch",
297
- );
298
- expect(fs.copy).toHaveBeenCalledWith(
299
- "/workspace/patches/v2/fix.patch",
300
- "/workspace/isolate/patches/v2/fix.patch",
301
- );
302
- });
303
-
304
- it("should preserve deeply nested patch paths", async () => {
305
- const targetManifest: PackageManifest = {
306
- name: "test",
307
- version: "1.0.0",
308
- dependencies: { lodash: "^4.0.0" },
309
- };
337
+ it("should preserve deeply nested patch paths", async () => {
338
+ const targetManifest: PackageManifest = {
339
+ name: "test",
340
+ version: "1.0.0",
341
+ dependencies: { lodash: "^4.0.0" },
342
+ };
310
343
 
311
- readTypedJson.mockResolvedValue({
312
- name: "root",
313
- version: "1.0.0",
314
- pnpm: {
344
+ mockManifest({
315
345
  patchedDependencies: {
316
346
  "lodash@4.17.21": "some/nested/path/lodash.patch",
317
347
  },
318
- },
319
- } as PackageManifest);
320
-
321
- filterPatchedDependencies.mockReturnValue({
322
- "lodash@4.17.21": "some/nested/path/lodash.patch",
348
+ });
349
+
350
+ filterPatchedDependencies.mockReturnValue({
351
+ "lodash@4.17.21": "some/nested/path/lodash.patch",
352
+ });
353
+
354
+ fs.existsSync.mockReturnValue(true);
355
+
356
+ const result = await copyPatches({
357
+ workspaceRootDir: "/workspace",
358
+ targetPackageManifest: targetManifest,
359
+ isolateDir: "/workspace/isolate",
360
+ includeDevDependencies: false,
361
+ });
362
+
363
+ /** The path should preserve the original directory structure */
364
+ expect(result).toEqual({
365
+ "lodash@4.17.21": { path: "some/nested/path/lodash.patch", hash: "" },
366
+ });
367
+ expect(fs.ensureDir).toHaveBeenCalledWith(
368
+ "/workspace/isolate/some/nested/path",
369
+ );
370
+ expect(fs.copy).toHaveBeenCalledWith(
371
+ "/workspace/some/nested/path/lodash.patch",
372
+ "/workspace/isolate/some/nested/path/lodash.patch",
373
+ );
323
374
  });
324
375
 
325
- fs.existsSync.mockReturnValue(true);
376
+ it("should copy multiple patches correctly", async () => {
377
+ const targetManifest: PackageManifest = {
378
+ name: "test",
379
+ version: "1.0.0",
380
+ dependencies: {
381
+ lodash: "^4.0.0",
382
+ "@firebase/app": "^1.0.0",
383
+ },
384
+ };
326
385
 
327
- const result = await copyPatches({
328
- workspaceRootDir: "/workspace",
329
- targetPackageManifest: targetManifest,
330
- isolateDir: "/workspace/isolate",
331
- includeDevDependencies: false,
386
+ mockManifest({
387
+ patchedDependencies: {
388
+ "lodash@4.17.21": "patches/lodash.patch",
389
+ "@firebase/app@1.2.3": "patches/firebase-app.patch",
390
+ },
391
+ });
392
+
393
+ filterPatchedDependencies.mockReturnValue({
394
+ "lodash@4.17.21": "patches/lodash.patch",
395
+ "@firebase/app@1.2.3": "patches/firebase-app.patch",
396
+ });
397
+
398
+ fs.existsSync.mockReturnValue(true);
399
+
400
+ const result = await copyPatches({
401
+ workspaceRootDir: "/workspace",
402
+ targetPackageManifest: targetManifest,
403
+ isolateDir: "/workspace/isolate",
404
+ includeDevDependencies: false,
405
+ });
406
+
407
+ expect(result).toEqual({
408
+ "lodash@4.17.21": { path: "patches/lodash.patch", hash: "" },
409
+ "@firebase/app@1.2.3": { path: "patches/firebase-app.patch", hash: "" },
410
+ });
411
+ expect(fs.copy).toHaveBeenCalledTimes(2);
332
412
  });
413
+ });
333
414
 
334
- /** The path should preserve the original directory structure */
335
- expect(result).toEqual({
336
- "lodash@4.17.21": { path: "some/nested/path/lodash.patch", hash: "" },
415
+ it("should read top-level patchedDependencies for Bun projects", async () => {
416
+ usePackageManager.mockReturnValue({
417
+ name: "bun",
418
+ majorVersion: 1,
419
+ version: "1.2.0",
420
+ packageManagerString: "bun@1.2.0",
337
421
  });
338
- expect(fs.ensureDir).toHaveBeenCalledWith(
339
- "/workspace/isolate/some/nested/path",
340
- );
341
- expect(fs.copy).toHaveBeenCalledWith(
342
- "/workspace/some/nested/path/lodash.patch",
343
- "/workspace/isolate/some/nested/path/lodash.patch",
344
- );
345
- });
346
422
 
347
- it("should copy multiple patches correctly", async () => {
348
423
  const targetManifest: PackageManifest = {
349
424
  name: "test",
350
425
  version: "1.0.0",
351
- dependencies: {
352
- lodash: "^4.0.0",
353
- "@firebase/app": "^1.0.0",
354
- },
426
+ dependencies: { lodash: "^4.0.0" },
355
427
  };
356
428
 
429
+ /** No patches in pnpm-workspace.yaml, so it falls back to package.json */
430
+ readTypedYamlSync.mockReturnValue({});
431
+
357
432
  readTypedJson.mockResolvedValue({
358
433
  name: "root",
359
434
  version: "1.0.0",
360
- pnpm: {
361
- patchedDependencies: {
362
- "lodash@4.17.21": "patches/lodash.patch",
363
- "@firebase/app@1.2.3": "patches/firebase-app.patch",
364
- },
435
+ patchedDependencies: {
436
+ "lodash@4.17.21": "patches/lodash.patch",
365
437
  },
366
438
  } as PackageManifest);
367
439
 
368
440
  filterPatchedDependencies.mockReturnValue({
369
441
  "lodash@4.17.21": "patches/lodash.patch",
370
- "@firebase/app@1.2.3": "patches/firebase-app.patch",
371
442
  });
372
443
 
373
444
  fs.existsSync.mockReturnValue(true);
@@ -381,8 +452,10 @@ describe("copyPatches", () => {
381
452
 
382
453
  expect(result).toEqual({
383
454
  "lodash@4.17.21": { path: "patches/lodash.patch", hash: "" },
384
- "@firebase/app@1.2.3": { path: "patches/firebase-app.patch", hash: "" },
385
455
  });
386
- expect(fs.copy).toHaveBeenCalledTimes(2);
456
+ expect(fs.copy).toHaveBeenCalledWith(
457
+ "/workspace/patches/lodash.patch",
458
+ "/workspace/isolate/patches/lodash.patch",
459
+ );
387
460
  });
388
461
  });