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