apify-test-tools 0.10.2-beta.4 → 0.10.2-beta.5

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.
Files changed (90) hide show
  1. package/.github/cli/apify-test-tools.mjs +125 -127
  2. package/.github/scripts/run-with-apify-tokens.mjs +1 -1
  3. package/CHANGELOG.md +5 -0
  4. package/CONTRIBUTING.md +4 -1
  5. package/README.md +69 -71
  6. package/bin/affected-actors.ts +132 -91
  7. package/bin/build.ts +0 -2
  8. package/bin/diff-changes.ts +7 -6
  9. package/bin/diff-json-schema.ts +5 -6
  10. package/bin/git.ts +21 -55
  11. package/bin/main.ts +7 -97
  12. package/bin/slack.ts +14 -27
  13. package/bin/types.ts +6 -0
  14. package/dist/bin/affected-actors.d.ts +23 -22
  15. package/dist/bin/affected-actors.d.ts.map +1 -1
  16. package/dist/bin/affected-actors.js +108 -60
  17. package/dist/bin/affected-actors.js.map +1 -1
  18. package/dist/bin/build.d.ts +0 -1
  19. package/dist/bin/build.d.ts.map +1 -1
  20. package/dist/bin/build.js +0 -2
  21. package/dist/bin/build.js.map +1 -1
  22. package/dist/bin/diff-changes.d.ts +4 -3
  23. package/dist/bin/diff-changes.d.ts.map +1 -1
  24. package/dist/bin/diff-changes.js +4 -4
  25. package/dist/bin/diff-changes.js.map +1 -1
  26. package/dist/bin/diff-json-schema.d.ts +2 -2
  27. package/dist/bin/diff-json-schema.d.ts.map +1 -1
  28. package/dist/bin/diff-json-schema.js +1 -4
  29. package/dist/bin/diff-json-schema.js.map +1 -1
  30. package/dist/bin/git.d.ts +6 -9
  31. package/dist/bin/git.d.ts.map +1 -1
  32. package/dist/bin/git.js +20 -48
  33. package/dist/bin/git.js.map +1 -1
  34. package/dist/bin/main.js +7 -77
  35. package/dist/bin/main.js.map +1 -1
  36. package/dist/bin/slack.d.ts +2 -7
  37. package/dist/bin/slack.d.ts.map +1 -1
  38. package/dist/bin/slack.js +12 -18
  39. package/dist/bin/slack.js.map +1 -1
  40. package/dist/bin/types.d.ts +5 -0
  41. package/dist/bin/types.d.ts.map +1 -1
  42. package/dist/test/bundle/cli-bundle.test.js +14 -16
  43. package/dist/test/bundle/cli-bundle.test.js.map +1 -1
  44. package/dist/test/e2e/cli-bundle.e2e.test.js +22 -63
  45. package/dist/test/e2e/cli-bundle.e2e.test.js.map +1 -1
  46. package/dist/test/e2e/git-build-release.e2e.test.d.ts +2 -0
  47. package/dist/test/e2e/git-build-release.e2e.test.d.ts.map +1 -0
  48. package/dist/test/e2e/git-build-release.e2e.test.js +87 -0
  49. package/dist/test/e2e/git-build-release.e2e.test.js.map +1 -0
  50. package/dist/test/e2e/helpers.d.ts +37 -0
  51. package/dist/test/e2e/helpers.d.ts.map +1 -0
  52. package/dist/test/e2e/helpers.js +57 -0
  53. package/dist/test/e2e/helpers.js.map +1 -0
  54. package/dist/test/unit/bin/affected-actors-cli.test.d.ts +2 -0
  55. package/dist/test/unit/bin/affected-actors-cli.test.d.ts.map +1 -0
  56. package/dist/test/unit/bin/affected-actors-cli.test.js +161 -0
  57. package/dist/test/unit/bin/affected-actors-cli.test.js.map +1 -0
  58. package/dist/test/unit/bin/affected-actors.test.js +65 -78
  59. package/dist/test/unit/bin/affected-actors.test.js.map +1 -1
  60. package/dist/test/unit/bin/build-cli.test.js +5 -13
  61. package/dist/test/unit/bin/build-cli.test.js.map +1 -1
  62. package/dist/test/unit/bin/compiled-cli.d.ts +6 -0
  63. package/dist/test/unit/bin/compiled-cli.d.ts.map +1 -0
  64. package/dist/test/unit/bin/compiled-cli.js +16 -0
  65. package/dist/test/unit/bin/compiled-cli.js.map +1 -0
  66. package/dist/test/unit/bin/diff-changes.test.js +55 -55
  67. package/dist/test/unit/bin/diff-changes.test.js.map +1 -1
  68. package/dist/test/unit/bin/diff.test.js +25 -28
  69. package/dist/test/unit/bin/diff.test.js.map +1 -1
  70. package/dist/test/unit/bin/git.test.js +29 -97
  71. package/dist/test/unit/bin/git.test.js.map +1 -1
  72. package/dist/test/unit/bin/slack.test.js +6 -27
  73. package/dist/test/unit/bin/slack.test.js.map +1 -1
  74. package/dist/test/unit/should-built-and-test.test.js +18 -21
  75. package/dist/test/unit/should-built-and-test.test.js.map +1 -1
  76. package/dist/tsconfig.tsbuildinfo +1 -1
  77. package/package.json +1 -1
  78. package/test/bundle/cli-bundle.test.ts +14 -24
  79. package/test/e2e/cli-bundle.e2e.test.ts +39 -84
  80. package/test/e2e/git-build-release.e2e.test.ts +113 -0
  81. package/test/e2e/helpers.ts +82 -0
  82. package/test/unit/bin/affected-actors-cli.test.ts +193 -0
  83. package/test/unit/bin/affected-actors.test.ts +83 -85
  84. package/test/unit/bin/build-cli.test.ts +6 -12
  85. package/test/unit/bin/compiled-cli.ts +17 -0
  86. package/test/unit/bin/diff-changes.test.ts +55 -55
  87. package/test/unit/bin/diff.test.ts +25 -28
  88. package/test/unit/bin/git.test.ts +37 -120
  89. package/test/unit/bin/slack.test.ts +6 -30
  90. package/test/unit/should-built-and-test.test.ts +19 -22
@@ -59,7 +59,7 @@ const amazonActor = actorConfig('junglee/amazon-crawler', 'actors/junglee_Amazon
59
59
  'shared',
60
60
  ]);
61
61
 
62
- const commits = [{ sha: 'Commit1', author: '', date: '', message: '' }];
62
+ const range = { fromRef: 'Commit0', toRef: 'Commit1' };
63
63
 
64
64
  // What a PR (functional changes only) or a release (isLatest, all changes) builds, in config order
65
65
  const changedActorsFor = async ({
@@ -78,14 +78,14 @@ describe('getChangedActors', () => {
78
78
  });
79
79
 
80
80
  it('returns empty array when no files changed', async () => {
81
- expect(await changedActorsFor({ filepathsChanged: [], actorConfigs, commits })).toEqual([]);
81
+ expect(await changedActorsFor({ filepathsChanged: [], actorConfigs, range })).toEqual([]);
82
82
  });
83
83
 
84
84
  it('returns empty array when only ignored top-level files changed', async () => {
85
85
  const result = await changedActorsFor({
86
86
  filepathsChanged: ['.gitignore', 'README.md', '.husky/pre-commit', '.vscode/settings.json'],
87
87
  actorConfigs,
88
- commits,
88
+ range,
89
89
  });
90
90
  expect(result).toEqual([]);
91
91
  });
@@ -94,7 +94,7 @@ describe('getChangedActors', () => {
94
94
  const result = await changedActorsFor({
95
95
  filepathsChanged: ['actors/foo_bar/src/.gitignore-helper.ts'],
96
96
  actorConfigs,
97
- commits,
97
+ range,
98
98
  });
99
99
  expect(result).toEqual([miniActor]);
100
100
  });
@@ -103,7 +103,7 @@ describe('getChangedActors', () => {
103
103
  const result = await changedActorsFor({
104
104
  filepathsChanged: ['actors/foo_bar/src/main.ts'],
105
105
  actorConfigs,
106
- commits,
106
+ range,
107
107
  });
108
108
  expect(result).toEqual([miniActor]);
109
109
  });
@@ -112,7 +112,7 @@ describe('getChangedActors', () => {
112
112
  const result = await changedActorsFor({
113
113
  filepathsChanged: ['actors/foo_bar/README.md'],
114
114
  actorConfigs,
115
- commits,
115
+ range,
116
116
  isLatest: true,
117
117
  });
118
118
  expect(result).toEqual([miniActor]);
@@ -122,7 +122,7 @@ describe('getChangedActors', () => {
122
122
  const result = await changedActorsFor({
123
123
  filepathsChanged: ['actors/foo_bar/README.md'],
124
124
  actorConfigs,
125
- commits,
125
+ range,
126
126
  isLatest: false,
127
127
  });
128
128
  expect(result).toEqual([]);
@@ -133,7 +133,7 @@ describe('getChangedActors', () => {
133
133
  const result = await changedActorsFor({
134
134
  filepathsChanged: ['actors/foo_bar/.actor/actor.json'],
135
135
  actorConfigs,
136
- commits,
136
+ range,
137
137
  isLatest: true,
138
138
  });
139
139
  expect(result).toEqual([miniActor]);
@@ -144,7 +144,7 @@ describe('getChangedActors', () => {
144
144
  const result = await changedActorsFor({
145
145
  filepathsChanged: ['actors/foo_bar/.actor/actor.json'],
146
146
  actorConfigs,
147
- commits,
147
+ range,
148
148
  isLatest: false,
149
149
  });
150
150
  expect(result).toEqual([]);
@@ -154,7 +154,7 @@ describe('getChangedActors', () => {
154
154
  const result = await changedActorsFor({
155
155
  filepathsChanged: ['actors/foo_bar/.actor/actor.json'],
156
156
  actorConfigs,
157
- commits,
157
+ range,
158
158
  });
159
159
  expect(result).toEqual([miniActor]);
160
160
  });
@@ -164,7 +164,7 @@ describe('getChangedActors', () => {
164
164
  const result = await changedActorsFor({
165
165
  filepathsChanged: ['actors/foo_bar/package.json'],
166
166
  actorConfigs,
167
- commits,
167
+ range,
168
168
  isLatest: false,
169
169
  });
170
170
  expect(result).toEqual([miniActor]);
@@ -176,12 +176,12 @@ describe('getChangedActors', () => {
176
176
  const result = await changedActorsFor({
177
177
  filepathsChanged: ['actors/foo_bar/.actor/input_schema.json'],
178
178
  actorConfigs,
179
- commits,
179
+ range,
180
180
  isLatest: false,
181
181
  });
182
182
  expect(result).toEqual([]);
183
183
  expect(DiffJsonSchema.isCosmeticOnlyJsonSchemaChange).toHaveBeenCalledWith(
184
- commits,
184
+ range,
185
185
  'actors/foo_bar/.actor/input_schema.json',
186
186
  );
187
187
  });
@@ -190,7 +190,7 @@ describe('getChangedActors', () => {
190
190
  const result = await changedActorsFor({
191
191
  filepathsChanged: ['shared/utils.ts'],
192
192
  actorConfigs,
193
- commits,
193
+ range,
194
194
  });
195
195
  expect(result).toContainEqual(miniActor);
196
196
  expect(result).not.toContainEqual(standaloneActor);
@@ -200,7 +200,7 @@ describe('getChangedActors', () => {
200
200
  const result = await changedActorsFor({
201
201
  filepathsChanged: ['CHANGELOG.md'],
202
202
  actorConfigs,
203
- commits,
203
+ range,
204
204
  isLatest: true,
205
205
  });
206
206
  expect(result).toEqual(expect.arrayContaining([miniActor, standaloneActor]));
@@ -211,7 +211,7 @@ describe('getChangedActors', () => {
211
211
  const result = await changedActorsFor({
212
212
  filepathsChanged: ['CHANGELOG.md'],
213
213
  actorConfigs,
214
- commits,
214
+ range,
215
215
  isLatest: false,
216
216
  });
217
217
  expect(result).toEqual([]);
@@ -221,7 +221,7 @@ describe('getChangedActors', () => {
221
221
  const result = await changedActorsFor({
222
222
  filepathsChanged: ['docs/CHANGELOG.md'],
223
223
  actorConfigs: [miniActor, standaloneActor],
224
- commits,
224
+ range,
225
225
  isLatest: true,
226
226
  });
227
227
  expect(result).toEqual([miniActor, standaloneActor]);
@@ -235,7 +235,7 @@ describe('getChangedActors', () => {
235
235
  const result = await changedActorsFor({
236
236
  filepathsChanged: ['docs/guide.md'],
237
237
  actorConfigs: [configuredActor],
238
- commits,
238
+ range,
239
239
  isLatest: true,
240
240
  });
241
241
  expect(result).toEqual([]);
@@ -245,7 +245,7 @@ describe('getChangedActors', () => {
245
245
  const result = await changedActorsFor({
246
246
  filepathsChanged: ['standalone-actors/standalone/src/main.ts'],
247
247
  actorConfigs,
248
- commits,
248
+ range,
249
249
  });
250
250
  expect(result).toContainEqual(standaloneActor);
251
251
  });
@@ -254,7 +254,7 @@ describe('getChangedActors', () => {
254
254
  const result = await changedActorsFor({
255
255
  filepathsChanged: ['actors/foo_bar/src/main.ts', 'actors/foo_bar/package.json'],
256
256
  actorConfigs,
257
- commits,
257
+ range,
258
258
  });
259
259
  expect(result).toHaveLength(1);
260
260
  expect(result).toContainEqual(miniActor);
@@ -264,7 +264,7 @@ describe('getChangedActors', () => {
264
264
  const result = await changedActorsFor({
265
265
  filepathsChanged: ['actors/foo_bar/src/main.ts', 'standalone-actors/standalone/Dockerfile'],
266
266
  actorConfigs,
267
- commits,
267
+ range,
268
268
  });
269
269
  expect(result).toContainEqual(miniActor);
270
270
  expect(result).toContainEqual(standaloneActor);
@@ -275,7 +275,7 @@ describe('getChangedActors', () => {
275
275
  const result = await changedActorsFor({
276
276
  filepathsChanged: ['actors/shopify/src/main.ts'],
277
277
  actorConfigs: [ownerlessActor],
278
- commits,
278
+ range,
279
279
  });
280
280
  expect(result).toEqual([ownerlessActor]);
281
281
  });
@@ -285,7 +285,7 @@ describe('getChangedActors', () => {
285
285
  const result = await changedActorsFor({
286
286
  filepathsChanged: ['.actor/actor.json'],
287
287
  actorConfigs: [rootActor],
288
- commits,
288
+ range,
289
289
  });
290
290
  expect(result).toEqual([rootActor]);
291
291
  });
@@ -294,7 +294,7 @@ describe('getChangedActors', () => {
294
294
  const result = await changedActorsFor({
295
295
  filepathsChanged: ['.actor/actor.json'],
296
296
  actorConfigs,
297
- commits,
297
+ range,
298
298
  });
299
299
  expect(result).toEqual([miniActor]);
300
300
  });
@@ -306,7 +306,7 @@ describe('getChangedActors', () => {
306
306
  const result = await changedActorsFor({
307
307
  filepathsChanged: ['Actors/FOO_BAR/Main.ts'],
308
308
  actorConfigs: [narrowActor],
309
- commits,
309
+ range,
310
310
  });
311
311
  expect(result).toEqual([]);
312
312
  });
@@ -322,7 +322,7 @@ describe('getChangedActors', () => {
322
322
  const result = await changedActorsFor({
323
323
  filepathsChanged: ['packages/shared/utils.ts'],
324
324
  actorConfigs: [overrideActor],
325
- commits,
325
+ range,
326
326
  });
327
327
  expect(result).toEqual([overrideActor]);
328
328
  });
@@ -338,7 +338,7 @@ describe('getChangedActors', () => {
338
338
  const result = await changedActorsFor({
339
339
  filepathsChanged: ['other-dir/file.ts'],
340
340
  actorConfigs: [overrideActor],
341
- commits,
341
+ range,
342
342
  });
343
343
  expect(result).toEqual([]);
344
344
  });
@@ -349,7 +349,7 @@ describe('getChangedActors', () => {
349
349
  const result = await changedActorsFor({
350
350
  filepathsChanged: ['actors/b/src/main.ts'],
351
351
  actorConfigs: [actorA, actorB],
352
- commits,
352
+ range,
353
353
  });
354
354
  expect(result).toEqual([actorB]);
355
355
  });
@@ -362,7 +362,7 @@ describe('getChangedActors', () => {
362
362
  const result = await changedActorsFor({
363
363
  filepathsChanged: ['actors/child/src/main.ts'],
364
364
  actorConfigs: [rootActor, childActor],
365
- commits,
365
+ range,
366
366
  });
367
367
  expect(result).not.toContainEqual(rootActor);
368
368
  expect(result).toContainEqual(childActor);
@@ -376,7 +376,7 @@ describe('getChangedActors', () => {
376
376
  const result = await changedActorsFor({
377
377
  filepathsChanged: ['lib/shared-utils.ts'],
378
378
  actorConfigs: [rootActor, childActor],
379
- commits,
379
+ range,
380
380
  });
381
381
  expect(result).toContainEqual(rootActor);
382
382
  expect(result).not.toContainEqual(childActor);
@@ -389,7 +389,7 @@ describe('getChangedActors', () => {
389
389
  const result = await changedActorsFor({
390
390
  filepathsChanged: ['actors/foo_bar/node_modules/foo.js'],
391
391
  actorConfigs: [miniActor],
392
- commits,
392
+ range,
393
393
  });
394
394
  expect(result).toEqual([]);
395
395
  });
@@ -399,7 +399,7 @@ describe('getChangedActors', () => {
399
399
  const result = await changedActorsFor({
400
400
  filepathsChanged: ['actors/foo_bar/src/main.ts'],
401
401
  actorConfigs: [miniActor],
402
- commits,
402
+ range,
403
403
  });
404
404
  expect(result).toEqual([miniActor]);
405
405
  });
@@ -409,7 +409,7 @@ describe('getChangedActors', () => {
409
409
  const result = await changedActorsFor({
410
410
  filepathsChanged: ['test/platform/daily/foo.test.ts'],
411
411
  actorConfigs: [miniActor],
412
- commits,
412
+ range,
413
413
  testFilesGlob: 'test/platform/**',
414
414
  });
415
415
  expect(result).toEqual([miniActor]);
@@ -420,7 +420,7 @@ describe('getChangedActors', () => {
420
420
  const result = await changedActorsFor({
421
421
  filepathsChanged: ['test/platform/daily/foo.test.ts'],
422
422
  actorConfigs: [miniActor],
423
- commits,
423
+ range,
424
424
  });
425
425
  expect(result).toEqual([]);
426
426
  });
@@ -430,7 +430,7 @@ describe('getChangedActors', () => {
430
430
  const result = await changedActorsFor({
431
431
  filepathsChanged: ['Test/Platform/Foo.test.ts'],
432
432
  actorConfigs: [miniActor],
433
- commits,
433
+ range,
434
434
  testFilesGlob: 'test/platform/**',
435
435
  });
436
436
  expect(result).toEqual([miniActor]);
@@ -438,7 +438,7 @@ describe('getChangedActors', () => {
438
438
  await changedActorsFor({
439
439
  filepathsChanged: ['actors/foo_bar/node_modules/foo.js'],
440
440
  actorConfigs: [miniActor],
441
- commits,
441
+ range,
442
442
  testFilesGlob: 'test/platform/**',
443
443
  }),
444
444
  ).toEqual([]);
@@ -449,7 +449,7 @@ describe('getChangedActors', () => {
449
449
  const result = await changedActorsFor({
450
450
  filepathsChanged: ['test/platform/daily/foo.test.ts'],
451
451
  actorConfigs: [standaloneActor],
452
- commits,
452
+ range,
453
453
  testFilesGlob: 'test/platform/**',
454
454
  });
455
455
  expect(result).toEqual([]);
@@ -464,7 +464,7 @@ describe('getChangedActors', () => {
464
464
  const result = await changedActorsFor({
465
465
  filepathsChanged: ['test/platform/standalone.test.ts'],
466
466
  actorConfigs: [actorWithTests],
467
- commits,
467
+ range,
468
468
  testFilesGlob: 'test/platform/**',
469
469
  });
470
470
  expect(result).toEqual([actorWithTests]);
@@ -474,7 +474,7 @@ describe('getChangedActors', () => {
474
474
  const result = await changedActorsFor({
475
475
  filepathsChanged: ['lib/config.json'],
476
476
  actorConfigs: [miniActor],
477
- commits,
477
+ range,
478
478
  });
479
479
  expect(result).toEqual([miniActor]);
480
480
  });
@@ -483,7 +483,7 @@ describe('getChangedActors', () => {
483
483
  const result = await changedActorsFor({
484
484
  filepathsChanged: ['docs/README.md'],
485
485
  actorConfigs: [miniActor],
486
- commits,
486
+ range,
487
487
  isLatest: true,
488
488
  });
489
489
  expect(result).toEqual([]);
@@ -493,7 +493,7 @@ describe('getChangedActors', () => {
493
493
  const result = await changedActorsFor({
494
494
  filepathsChanged: ['actors/foo_bar/README.md'],
495
495
  actorConfigs: [miniActor],
496
- commits,
496
+ range,
497
497
  isLatest: true,
498
498
  });
499
499
  expect(result).toEqual([miniActor]);
@@ -503,7 +503,7 @@ describe('getChangedActors', () => {
503
503
  const result = await changedActorsFor({
504
504
  filepathsChanged: ['standalone-actors/standalone/.eslintrc'],
505
505
  actorConfigs,
506
- commits,
506
+ range,
507
507
  });
508
508
  expect(result).toEqual([]);
509
509
  });
@@ -512,7 +512,7 @@ describe('getChangedActors', () => {
512
512
  const result = await changedActorsFor({
513
513
  filepathsChanged: ['code/some/code.ts'],
514
514
  actorConfigs: [miniActor],
515
- commits,
515
+ range,
516
516
  });
517
517
  expect(result).toEqual([miniActor]);
518
518
  });
@@ -521,7 +521,7 @@ describe('getChangedActors', () => {
521
521
  const result = await changedActorsFor({
522
522
  filepathsChanged: ['code/.eslintrc'],
523
523
  actorConfigs: [amazonActor],
524
- commits,
524
+ range,
525
525
  });
526
526
  expect(result).toEqual([]);
527
527
  });
@@ -530,7 +530,7 @@ describe('getChangedActors', () => {
530
530
  const result = await changedActorsFor({
531
531
  filepathsChanged: ['shared/Dockerfile'],
532
532
  actorConfigs: [amazonActor],
533
- commits,
533
+ range,
534
534
  });
535
535
  expect(result).toEqual([amazonActor]);
536
536
  });
@@ -539,7 +539,7 @@ describe('getChangedActors', () => {
539
539
  const result = await changedActorsFor({
540
540
  filepathsChanged: ['code/README.md'],
541
541
  actorConfigs: [amazonActor],
542
- commits,
542
+ range,
543
543
  isLatest: true,
544
544
  });
545
545
  expect(result).toEqual([]);
@@ -557,7 +557,7 @@ describe('getChangedActors logging', () => {
557
557
  await getChangedActors({
558
558
  filepathsChanged: ['actors/foo_bar/src/main.ts'],
559
559
  actorConfigs: [miniActor],
560
- commits,
560
+ range,
561
561
  });
562
562
 
563
563
  expect(logger.info).toHaveBeenCalledWith(
@@ -574,7 +574,7 @@ describe('getChangedActors logging', () => {
574
574
  await getChangedActors({
575
575
  filepathsChanged: ['shared/shared.ts'],
576
576
  actorConfigs: [actorA, actorB],
577
- commits,
577
+ range,
578
578
  });
579
579
 
580
580
  expect(logger.info).toHaveBeenCalledWith(
@@ -591,7 +591,7 @@ describe('getChangedActors logging', () => {
591
591
  await getChangedActors({
592
592
  filepathsChanged: ['shared.ts', 'actors/a/a-only.ts', 'actors/b/b-only.ts'],
593
593
  actorConfigs: [actorA, actorB],
594
- commits,
594
+ range,
595
595
  });
596
596
 
597
597
  const errorCalls = vi.mocked(logger.info).mock.calls.map((call) => call[0]);
@@ -613,7 +613,7 @@ describe('getChangedActors logging', () => {
613
613
  await getChangedActors({
614
614
  filepathsChanged: ['test/platform/standalone.test.ts'],
615
615
  actorConfigs: [standaloneActor],
616
- commits,
616
+ range,
617
617
  testFilesGlob: 'test/platform/**',
618
618
  });
619
619
 
@@ -624,7 +624,7 @@ describe('getChangedActors logging', () => {
624
624
  const result = await changedActorsFor({
625
625
  filepathsChanged: ['test/platform/standalone.test.ts', 'standalone-actors/standalone/src/main.ts'],
626
626
  actorConfigs: [standaloneActor],
627
- commits,
627
+ range,
628
628
  testFilesGlob: 'test/platform/**',
629
629
  });
630
630
 
@@ -636,7 +636,7 @@ describe('getChangedActors logging', () => {
636
636
  await getChangedActors({
637
637
  filepathsChanged: ['test/platform/foo.test.ts', 'test/platform/README.md', 'test/platform/CHANGELOG.md'],
638
638
  actorConfigs: [miniActor],
639
- commits,
639
+ range,
640
640
  testFilesGlob: 'test/platform/**',
641
641
  });
642
642
 
@@ -647,7 +647,7 @@ describe('getChangedActors logging', () => {
647
647
  await getChangedActors({
648
648
  filepathsChanged: ['.gitignore', '.prettierrc'],
649
649
  actorConfigs,
650
- commits,
650
+ range,
651
651
  });
652
652
 
653
653
  expect(logger.info).not.toHaveBeenCalledWith(expect.stringContaining('Shared changes'));
@@ -670,14 +670,14 @@ describe('getChangedActors split by impact', () => {
670
670
  'actors/foo_bar/src/main.ts',
671
671
  ],
672
672
  actorConfigs,
673
- commits,
673
+ range,
674
674
  });
675
675
  expect(result).toStrictEqual({ functional: [miniActor], cosmetic: [standaloneActor] });
676
676
  });
677
677
 
678
678
  it('returns empty lists when nothing relevant changed', async () => {
679
679
  expect(
680
- await getChangedActors({ filepathsChanged: ['.vscode/settings.json'], actorConfigs, commits }),
680
+ await getChangedActors({ filepathsChanged: ['.vscode/settings.json'], actorConfigs, range }),
681
681
  ).toStrictEqual({ functional: [], cosmetic: [] });
682
682
  });
683
683
  });
@@ -4,10 +4,7 @@ import { beforeEach, describe, expect, it, test, vi } from 'vitest';
4
4
  import { isCosmeticOnlyJsonSchemaChange } from '../../../bin/diff-json-schema.js';
5
5
  import * as Utils from '../../../bin/utils.js';
6
6
 
7
- const commits = [
8
- { sha: 'Commit1', author: '', date: '', message: '' },
9
- { sha: 'Commit3', author: '', date: '', message: '' },
10
- ];
7
+ const range = { fromRef: 'Commit0', toRef: 'Commit3' };
11
8
 
12
9
  describe('isCosmeticOnlyJsonSchemaChange', () => {
13
10
  let gitCommandSpy: MockInstance;
@@ -23,7 +20,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
23
20
  test('returns true when nothing changed', async () => {
24
21
  const json = JSON.stringify({ type: 'string', title: 'My field' });
25
22
  mockGitCalls(json, json);
26
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
23
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
27
24
  });
28
25
 
29
26
  test('returns true when only title changes', async () => {
@@ -31,7 +28,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
31
28
  JSON.stringify({ type: 'string', title: 'Old title' }),
32
29
  JSON.stringify({ type: 'string', title: 'New title' }),
33
30
  );
34
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
31
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
35
32
  });
36
33
 
37
34
  test('returns true when only description changes', async () => {
@@ -39,7 +36,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
39
36
  JSON.stringify({ type: 'string', description: 'Old desc' }),
40
37
  JSON.stringify({ type: 'string', description: 'New desc' }),
41
38
  );
42
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
39
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
43
40
  });
44
41
 
45
42
  test('returns true when only example changes', async () => {
@@ -47,7 +44,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
47
44
  JSON.stringify({ type: 'string', example: 'foo' }),
48
45
  JSON.stringify({ type: 'string', example: 'bar' }),
49
46
  );
50
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
47
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
51
48
  });
52
49
 
53
50
  test('returns true when only enumTitles changes', async () => {
@@ -55,7 +52,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
55
52
  JSON.stringify({ type: 'string', enum: ['a', 'b'], enumTitles: ['Option A', 'Option B'] }),
56
53
  JSON.stringify({ type: 'string', enum: ['a', 'b'], enumTitles: ['Choice A', 'Choice B'] }),
57
54
  );
58
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
55
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
59
56
  });
60
57
 
61
58
  test('returns true when only sectionCaption changes', async () => {
@@ -63,12 +60,12 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
63
60
  JSON.stringify({ sectionCaption: 'Old caption' }),
64
61
  JSON.stringify({ sectionCaption: 'New caption' }),
65
62
  );
66
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
63
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
67
64
  });
68
65
 
69
66
  test('returns true when only sectionDescription changes', async () => {
70
67
  mockGitCalls(JSON.stringify({ sectionDescription: 'Old' }), JSON.stringify({ sectionDescription: 'New' }));
71
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
68
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
72
69
  });
73
70
 
74
71
  test('returns false when a functional field (type) changes', async () => {
@@ -76,17 +73,17 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
76
73
  JSON.stringify({ type: 'string', title: 'My field' }),
77
74
  JSON.stringify({ type: 'integer', title: 'My field' }),
78
75
  );
79
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
76
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
80
77
  });
81
78
 
82
79
  test('returns false when a functional field is added', async () => {
83
80
  mockGitCalls(JSON.stringify({ title: 'My field' }), JSON.stringify({ title: 'My field', type: 'string' }));
84
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
81
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
85
82
  });
86
83
 
87
84
  test('returns false when a functional field is removed', async () => {
88
85
  mockGitCalls(JSON.stringify({ type: 'string', title: 'My field' }), JSON.stringify({ title: 'My field' }));
89
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
86
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
90
87
  });
91
88
 
92
89
  test('returns true when non-functional fields change at nested level (input schema properties)', async () => {
@@ -104,7 +101,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
104
101
  },
105
102
  }),
106
103
  );
107
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
104
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
108
105
  });
109
106
 
110
107
  test('returns false when a functional nested field changes alongside non-functional ones', async () => {
@@ -118,7 +115,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
118
115
  properties: { myField: { type: 'integer', title: 'New title' } },
119
116
  }),
120
117
  );
121
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
118
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
122
119
  });
123
120
 
124
121
  test('returns false when a new property is added to input schema', async () => {
@@ -126,7 +123,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
126
123
  JSON.stringify({ properties: { fieldA: { type: 'string' } } }),
127
124
  JSON.stringify({ properties: { fieldA: { type: 'string' }, fieldB: { type: 'integer' } } }),
128
125
  );
129
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
126
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
130
127
  });
131
128
 
132
129
  test('returns false when a property is removed from input schema', async () => {
@@ -134,27 +131,27 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
134
131
  JSON.stringify({ properties: { fieldA: { type: 'string' }, fieldB: { type: 'integer' } } }),
135
132
  JSON.stringify({ properties: { fieldA: { type: 'string' } } }),
136
133
  );
137
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
134
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
138
135
  });
139
136
 
140
137
  test('returns false when invalid JSON in old content', async () => {
141
138
  mockGitCalls('not json', '{}');
142
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
139
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
143
140
  });
144
141
 
145
142
  test('returns false when invalid JSON in new content', async () => {
146
143
  mockGitCalls('{}', 'not json');
147
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
144
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
148
145
  });
149
146
 
150
147
  test('returns false when git cannot read a schema version', async () => {
151
148
  gitCommandSpy.mockRejectedValueOnce(new Error('missing schema'));
152
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
149
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
153
150
  });
154
151
 
155
152
  test('returns false when array content changes (not under a non-functional key)', async () => {
156
153
  mockGitCalls(JSON.stringify({ enum: [1, 2, 3] }), JSON.stringify({ enum: [1, 2, 4] }));
157
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
154
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
158
155
  });
159
156
 
160
157
  test('returns true when example array changes (non-functional key)', async () => {
@@ -162,7 +159,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
162
159
  JSON.stringify({ type: 'array', example: [1, 2, 3] }),
163
160
  JSON.stringify({ type: 'array', example: [4, 5, 6] }),
164
161
  );
165
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
162
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
166
163
  });
167
164
 
168
165
  test('returns true for a realistic actor.json with only title/description change', async () => {
@@ -182,7 +179,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
182
179
  version: '1.0',
183
180
  }),
184
181
  );
185
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
182
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
186
183
  });
187
184
 
188
185
  test('returns true when fields under properties are reordered', async () => {
@@ -196,7 +193,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
196
193
  properties: { fieldC: { type: 'boolean' }, fieldA: { type: 'string' }, fieldB: { type: 'integer' } },
197
194
  }),
198
195
  );
199
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(true);
196
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
200
197
  });
201
198
 
202
199
  test('returns false for a realistic actor.json with version change', async () => {
@@ -204,14 +201,14 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
204
201
  JSON.stringify({ actorSpecification: 1, name: 'my-actor', title: 'My Actor', version: '1.0' }),
205
202
  JSON.stringify({ actorSpecification: 1, name: 'my-actor', title: 'My Actor', version: '1.1' }),
206
203
  );
207
- await expect(isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json')).resolves.toBe(false);
204
+ await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
208
205
  });
209
206
 
210
207
  it('uses correct git refs: first-commit parent for old, last commit for new', async () => {
211
208
  const json = JSON.stringify({});
212
209
  mockGitCalls(json, json);
213
- await isCosmeticOnlyJsonSchemaChange(commits, 'actors/foo/actor.json');
214
- expect(gitCommandSpy).toHaveBeenCalledWith(['show', 'Commit1~:actors/foo/actor.json']);
210
+ await isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json');
211
+ expect(gitCommandSpy).toHaveBeenCalledWith(['show', 'Commit0:actors/foo/actor.json']);
215
212
  expect(gitCommandSpy).toHaveBeenCalledWith(['show', 'Commit3:actors/foo/actor.json']);
216
213
  });
217
214
  });