apify-test-tools 0.10.1-beta.2 → 0.10.1-beta.4

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 (147) hide show
  1. package/.github/actions/checkout-restore-dependencies/action.yaml +4 -3
  2. package/.github/workflows/public_platform-tests-claude-investigate-and-fix.yaml +7 -2
  3. package/.github/workflows/public_platform-tests.yaml +0 -1
  4. package/.github/workflows-package-version +1 -1
  5. package/CHANGELOG.md +6 -0
  6. package/CONTRIBUTING.md +13 -3
  7. package/README.md +2 -2
  8. package/bin/build-from-local.ts +8 -7
  9. package/bin/build.ts +22 -21
  10. package/bin/diff-changes.ts +11 -10
  11. package/bin/diff-json-schema.ts +14 -12
  12. package/bin/git.ts +89 -47
  13. package/bin/logger.ts +23 -0
  14. package/bin/main.ts +44 -38
  15. package/bin/output.ts +6 -0
  16. package/bin/slack.ts +8 -7
  17. package/bin/test-report.ts +22 -21
  18. package/bin/types.ts +0 -1
  19. package/bin/utils/config/actor-json.ts +84 -0
  20. package/bin/utils/config/load-config.ts +46 -46
  21. package/bin/utils/config/parser.ts +33 -28
  22. package/bin/utils/config/structures/base.ts +7 -0
  23. package/bin/utils/json-file.ts +11 -14
  24. package/bin/utils/path/repo-relative.ts +156 -0
  25. package/bin/utils/path/schema.ts +18 -0
  26. package/bin/utils.ts +63 -44
  27. package/dist/bin/build-from-local.d.ts +1 -1
  28. package/dist/bin/build-from-local.d.ts.map +1 -1
  29. package/dist/bin/build-from-local.js +8 -7
  30. package/dist/bin/build-from-local.js.map +1 -1
  31. package/dist/bin/build.d.ts.map +1 -1
  32. package/dist/bin/build.js +22 -21
  33. package/dist/bin/build.js.map +1 -1
  34. package/dist/bin/diff-changes.d.ts +1 -1
  35. package/dist/bin/diff-changes.d.ts.map +1 -1
  36. package/dist/bin/diff-changes.js +9 -8
  37. package/dist/bin/diff-changes.js.map +1 -1
  38. package/dist/bin/diff-json-schema.d.ts +1 -1
  39. package/dist/bin/diff-json-schema.d.ts.map +1 -1
  40. package/dist/bin/diff-json-schema.js +13 -12
  41. package/dist/bin/diff-json-schema.js.map +1 -1
  42. package/dist/bin/git.d.ts +10 -10
  43. package/dist/bin/git.d.ts.map +1 -1
  44. package/dist/bin/git.js +78 -37
  45. package/dist/bin/git.js.map +1 -1
  46. package/dist/bin/logger.d.ts +11 -0
  47. package/dist/bin/logger.d.ts.map +1 -0
  48. package/dist/bin/logger.js +20 -0
  49. package/dist/bin/logger.js.map +1 -0
  50. package/dist/bin/main.d.ts +1 -1
  51. package/dist/bin/main.js +44 -38
  52. package/dist/bin/main.js.map +1 -1
  53. package/dist/bin/output.d.ts +3 -0
  54. package/dist/bin/output.d.ts.map +1 -0
  55. package/dist/bin/output.js +6 -0
  56. package/dist/bin/output.js.map +1 -0
  57. package/dist/bin/slack.d.ts.map +1 -1
  58. package/dist/bin/slack.js +8 -7
  59. package/dist/bin/slack.js.map +1 -1
  60. package/dist/bin/test-report.d.ts.map +1 -1
  61. package/dist/bin/test-report.js +22 -21
  62. package/dist/bin/test-report.js.map +1 -1
  63. package/dist/bin/types.d.ts +0 -1
  64. package/dist/bin/types.d.ts.map +1 -1
  65. package/dist/bin/utils/config/actor-json.d.ts +14 -0
  66. package/dist/bin/utils/config/actor-json.d.ts.map +1 -0
  67. package/dist/bin/utils/config/actor-json.js +60 -0
  68. package/dist/bin/utils/config/actor-json.js.map +1 -0
  69. package/dist/bin/utils/config/load-config.d.ts +12 -2
  70. package/dist/bin/utils/config/load-config.d.ts.map +1 -1
  71. package/dist/bin/utils/config/load-config.js +32 -31
  72. package/dist/bin/utils/config/load-config.js.map +1 -1
  73. package/dist/bin/utils/config/parser.d.ts +4 -12
  74. package/dist/bin/utils/config/parser.d.ts.map +1 -1
  75. package/dist/bin/utils/config/parser.js +24 -23
  76. package/dist/bin/utils/config/parser.js.map +1 -1
  77. package/dist/bin/utils/config/structures/base.d.ts +5 -0
  78. package/dist/bin/utils/config/structures/base.d.ts.map +1 -1
  79. package/dist/bin/utils/config/structures/base.js.map +1 -1
  80. package/dist/bin/utils/json-file.d.ts +3 -2
  81. package/dist/bin/utils/json-file.d.ts.map +1 -1
  82. package/dist/bin/utils/json-file.js +8 -13
  83. package/dist/bin/utils/json-file.js.map +1 -1
  84. package/dist/bin/utils/path/repo-relative.d.ts +35 -0
  85. package/dist/bin/utils/path/repo-relative.d.ts.map +1 -0
  86. package/dist/bin/utils/path/repo-relative.js +137 -0
  87. package/dist/bin/utils/path/repo-relative.js.map +1 -0
  88. package/dist/bin/utils/path/schema.d.ts +7 -0
  89. package/dist/bin/utils/path/schema.d.ts.map +1 -0
  90. package/dist/bin/utils/path/schema.js +16 -0
  91. package/dist/bin/utils/path/schema.js.map +1 -0
  92. package/dist/bin/utils.d.ts +14 -6
  93. package/dist/bin/utils.d.ts.map +1 -1
  94. package/dist/bin/utils.js +52 -36
  95. package/dist/bin/utils.js.map +1 -1
  96. package/dist/test/unit/bin/build-from-local.test.js +4 -40
  97. package/dist/test/unit/bin/build-from-local.test.js.map +1 -1
  98. package/dist/test/unit/bin/diff-changes.test.js +97 -96
  99. package/dist/test/unit/bin/diff-changes.test.js.map +1 -1
  100. package/dist/test/unit/bin/diff.test.js +52 -48
  101. package/dist/test/unit/bin/diff.test.js.map +1 -1
  102. package/dist/test/unit/bin/git-command.test.d.ts +2 -0
  103. package/dist/test/unit/bin/git-command.test.d.ts.map +1 -0
  104. package/dist/test/unit/bin/git-command.test.js +54 -0
  105. package/dist/test/unit/bin/git-command.test.js.map +1 -0
  106. package/dist/test/unit/bin/git.test.js +211 -94
  107. package/dist/test/unit/bin/git.test.js.map +1 -1
  108. package/dist/test/unit/bin/logger.test.d.ts +2 -0
  109. package/dist/test/unit/bin/logger.test.d.ts.map +1 -0
  110. package/dist/test/unit/bin/logger.test.js +44 -0
  111. package/dist/test/unit/bin/logger.test.js.map +1 -0
  112. package/dist/test/unit/bin/logging.test.d.ts +2 -0
  113. package/dist/test/unit/bin/logging.test.d.ts.map +1 -0
  114. package/dist/test/unit/bin/logging.test.js +43 -0
  115. package/dist/test/unit/bin/logging.test.js.map +1 -0
  116. package/dist/test/unit/bin/utils/config/load-config.test.js +47 -25
  117. package/dist/test/unit/bin/utils/config/load-config.test.js.map +1 -1
  118. package/dist/test/unit/bin/utils/config/parser.test.js +64 -19
  119. package/dist/test/unit/bin/utils/config/parser.test.js.map +1 -1
  120. package/dist/test/unit/bin/utils/files.test.js +16 -27
  121. package/dist/test/unit/bin/utils/files.test.js.map +1 -1
  122. package/dist/test/unit/bin/utils/path/repo-relative.test.d.ts +2 -0
  123. package/dist/test/unit/bin/utils/path/repo-relative.test.d.ts.map +1 -0
  124. package/dist/test/unit/bin/utils/path/repo-relative.test.js +196 -0
  125. package/dist/test/unit/bin/utils/path/repo-relative.test.js.map +1 -0
  126. package/dist/test/unit/bin/utils/path/schema.test.d.ts +2 -0
  127. package/dist/test/unit/bin/utils/path/schema.test.d.ts.map +1 -0
  128. package/dist/test/unit/bin/utils/path/schema.test.js +52 -0
  129. package/dist/test/unit/bin/utils/path/schema.test.js.map +1 -0
  130. package/dist/test/unit/should-built-and-test.test.js +40 -38
  131. package/dist/test/unit/should-built-and-test.test.js.map +1 -1
  132. package/dist/tsconfig.tsbuildinfo +1 -1
  133. package/eslint.config.mjs +9 -1
  134. package/package.json +5 -5
  135. package/test/unit/bin/build-from-local.test.ts +4 -54
  136. package/test/unit/bin/diff-changes.test.ts +97 -96
  137. package/test/unit/bin/diff.test.ts +53 -48
  138. package/test/unit/bin/git-command.test.ts +71 -0
  139. package/test/unit/bin/git.test.ts +246 -91
  140. package/test/unit/bin/logger.test.ts +55 -0
  141. package/test/unit/bin/logging.test.ts +52 -0
  142. package/test/unit/bin/utils/config/load-config.test.ts +63 -26
  143. package/test/unit/bin/utils/config/parser.test.ts +81 -27
  144. package/test/unit/bin/utils/files.test.ts +19 -33
  145. package/test/unit/bin/utils/path/repo-relative.test.ts +250 -0
  146. package/test/unit/bin/utils/path/schema.test.ts +65 -0
  147. package/test/unit/should-built-and-test.test.ts +40 -38
@@ -3,6 +3,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
3
3
  import { getChangedActors } from '../../../bin/diff-changes.js';
4
4
  import * as DiffJsonSchema from '../../../bin/diff-json-schema.js';
5
5
  import * as Dockerignore from '../../../bin/dockerignore.js';
6
+ import { logger } from '../../../bin/logger.js';
6
7
  import type { ActorConfig } from '../../../bin/types.js';
7
8
 
8
9
  const miniActor: ActorConfig = {
@@ -32,15 +33,15 @@ const commits = [{ sha: 'Commit1', author: '', date: '', message: '' }];
32
33
 
33
34
  describe('getChangedActors', () => {
34
35
  beforeEach(() => {
35
- vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockReturnValue(false);
36
+ vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(false);
36
37
  });
37
38
 
38
- it('returns empty array when no files changed', () => {
39
- expect(getChangedActors({ filepathsChanged: [], actorConfigs, commits })).toEqual([]);
39
+ it('returns empty array when no files changed', async () => {
40
+ expect(await getChangedActors({ filepathsChanged: [], actorConfigs, commits })).toEqual([]);
40
41
  });
41
42
 
42
- it('returns empty array when only ignored top-level files changed', () => {
43
- const result = getChangedActors({
43
+ it('returns empty array when only ignored top-level files changed', async () => {
44
+ const result = await getChangedActors({
44
45
  filepathsChanged: ['.gitignore', 'README.md', '.husky/pre-commit', '.vscode/settings.json'],
45
46
  actorConfigs,
46
47
  commits,
@@ -48,8 +49,8 @@ describe('getChangedActors', () => {
48
49
  expect(result).toEqual([]);
49
50
  });
50
51
 
51
- it('returns the actor when a functional file in its folder changes', () => {
52
- const result = getChangedActors({
52
+ it('returns the actor when a functional file in its folder changes', async () => {
53
+ const result = await getChangedActors({
53
54
  filepathsChanged: ['actors/foo_bar/src/main.ts'],
54
55
  actorConfigs,
55
56
  commits,
@@ -57,8 +58,8 @@ describe('getChangedActors', () => {
57
58
  expect(result).toEqual([miniActor]);
58
59
  });
59
60
 
60
- it('returns actor when isLatest and README in actor folder changed (cosmetic)', () => {
61
- const result = getChangedActors({
61
+ it('returns actor when isLatest and README in actor folder changed (cosmetic)', async () => {
62
+ const result = await getChangedActors({
62
63
  filepathsChanged: ['actors/foo_bar/README.md'],
63
64
  actorConfigs,
64
65
  commits,
@@ -67,8 +68,8 @@ describe('getChangedActors', () => {
67
68
  expect(result).toEqual([miniActor]);
68
69
  });
69
70
 
70
- it('does not return actor when not isLatest and only README changed (cosmetic)', () => {
71
- const result = getChangedActors({
71
+ it('does not return actor when not isLatest and only README changed (cosmetic)', async () => {
72
+ const result = await getChangedActors({
72
73
  filepathsChanged: ['actors/foo_bar/README.md'],
73
74
  actorConfigs,
74
75
  commits,
@@ -77,9 +78,9 @@ describe('getChangedActors', () => {
77
78
  expect(result).toEqual([]);
78
79
  });
79
80
 
80
- it('returns actor when isLatest and JSON file has only cosmetic changes', () => {
81
- vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockReturnValue(true);
82
- const result = getChangedActors({
81
+ it('returns actor when isLatest and JSON file has only cosmetic changes', async () => {
82
+ vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(true);
83
+ const result = await getChangedActors({
83
84
  filepathsChanged: ['actors/foo_bar/.actor/actor.json'],
84
85
  actorConfigs,
85
86
  commits,
@@ -88,9 +89,9 @@ describe('getChangedActors', () => {
88
89
  expect(result).toEqual([miniActor]);
89
90
  });
90
91
 
91
- it('does not return actor when not isLatest and JSON file has only cosmetic changes', () => {
92
- vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockReturnValue(true);
93
- const result = getChangedActors({
92
+ it('does not return actor when not isLatest and JSON file has only cosmetic changes', async () => {
93
+ vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(true);
94
+ const result = await getChangedActors({
94
95
  filepathsChanged: ['actors/foo_bar/.actor/actor.json'],
95
96
  actorConfigs,
96
97
  commits,
@@ -99,9 +100,9 @@ describe('getChangedActors', () => {
99
100
  expect(result).toEqual([]);
100
101
  });
101
102
 
102
- it('returns actor when JSON file has functional changes', () => {
103
- vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockReturnValue(false);
104
- const result = getChangedActors({
103
+ it('returns actor when JSON file has functional changes', async () => {
104
+ vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(false);
105
+ const result = await getChangedActors({
105
106
  filepathsChanged: ['actors/foo_bar/.actor/actor.json'],
106
107
  actorConfigs,
107
108
  commits,
@@ -109,9 +110,9 @@ describe('getChangedActors', () => {
109
110
  expect(result).toEqual([miniActor]);
110
111
  });
111
112
 
112
- it('JSON file in actor folder but outside .actor/ is functional, not checked for cosmetic', () => {
113
- vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockReturnValue(true);
114
- const result = getChangedActors({
113
+ it('JSON file in actor folder but outside .actor/ is functional, not checked for cosmetic', async () => {
114
+ vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(true);
115
+ const result = await getChangedActors({
115
116
  filepathsChanged: ['actors/foo_bar/package.json'],
116
117
  actorConfigs,
117
118
  commits,
@@ -121,9 +122,9 @@ describe('getChangedActors', () => {
121
122
  expect(DiffJsonSchema.isCosmeticOnlyJsonSchemaChange).not.toHaveBeenCalled();
122
123
  });
123
124
 
124
- it('JSON file under .actor/ inside actor folder is checked for cosmetic changes', () => {
125
- vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockReturnValue(true);
126
- const result = getChangedActors({
125
+ it('JSON file under .actor/ inside actor folder is checked for cosmetic changes', async () => {
126
+ vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(true);
127
+ const result = await getChangedActors({
127
128
  filepathsChanged: ['actors/foo_bar/.actor/input_schema.json'],
128
129
  actorConfigs,
129
130
  commits,
@@ -132,8 +133,8 @@ describe('getChangedActors', () => {
132
133
  expect(result).toEqual([miniActor]);
133
134
  });
134
135
 
135
- it('does not trigger narrow-context actor when shared file changes', () => {
136
- const result = getChangedActors({
136
+ it('does not trigger narrow-context actor when shared file changes', async () => {
137
+ const result = await getChangedActors({
137
138
  filepathsChanged: ['shared/utils.ts'],
138
139
  actorConfigs,
139
140
  commits,
@@ -142,8 +143,8 @@ describe('getChangedActors', () => {
142
143
  expect(result).not.toContainEqual(standaloneActor);
143
144
  });
144
145
 
145
- it('root-level changelog outside any actor folder is cosmetic for every actor when isLatest', () => {
146
- const result = getChangedActors({
146
+ it('root-level changelog outside any actor folder is cosmetic for every actor when isLatest', async () => {
147
+ const result = await getChangedActors({
147
148
  filepathsChanged: ['CHANGELOG.md'],
148
149
  actorConfigs,
149
150
  commits,
@@ -153,8 +154,8 @@ describe('getChangedActors', () => {
153
154
  expect(result).toHaveLength(2);
154
155
  });
155
156
 
156
- it('root-level changelog is not cosmetic-triggered when not isLatest', () => {
157
- const result = getChangedActors({
157
+ it('root-level changelog is not cosmetic-triggered when not isLatest', async () => {
158
+ const result = await getChangedActors({
158
159
  filepathsChanged: ['CHANGELOG.md'],
159
160
  actorConfigs,
160
161
  commits,
@@ -163,8 +164,8 @@ describe('getChangedActors', () => {
163
164
  expect(result).toEqual([]);
164
165
  });
165
166
 
166
- it('triggers narrow-context actor when its own folder changes', () => {
167
- const result = getChangedActors({
167
+ it('triggers narrow-context actor when its own folder changes', async () => {
168
+ const result = await getChangedActors({
168
169
  filepathsChanged: ['standalone-actors/standalone/src/main.ts'],
169
170
  actorConfigs,
170
171
  commits,
@@ -172,8 +173,8 @@ describe('getChangedActors', () => {
172
173
  expect(result).toContainEqual(standaloneActor);
173
174
  });
174
175
 
175
- it('deduplicates actors when multiple files in same actor folder change', () => {
176
- const result = getChangedActors({
176
+ it('deduplicates actors when multiple files in same actor folder change', async () => {
177
+ const result = await getChangedActors({
177
178
  filepathsChanged: ['actors/foo_bar/src/main.ts', 'actors/foo_bar/package.json'],
178
179
  actorConfigs,
179
180
  commits,
@@ -182,8 +183,8 @@ describe('getChangedActors', () => {
182
183
  expect(result).toContainEqual(miniActor);
183
184
  });
184
185
 
185
- it('handles mixed changes: returns both broad and narrow-context actors', () => {
186
- const result = getChangedActors({
186
+ it('handles mixed changes: returns both broad and narrow-context actors', async () => {
187
+ const result = await getChangedActors({
187
188
  filepathsChanged: ['actors/foo_bar/src/main.ts', 'standalone-actors/standalone/Dockerfile'],
188
189
  actorConfigs,
189
190
  commits,
@@ -192,7 +193,7 @@ describe('getChangedActors', () => {
192
193
  expect(result).toContainEqual(standaloneActor);
193
194
  });
194
195
 
195
- it('matches folder where folder name differs from actor name', () => {
196
+ it('matches folder where folder name differs from actor name', async () => {
196
197
  const ownerlessActor: ActorConfig = {
197
198
  actorFullName: 'myteam/shopify-scraper',
198
199
  folder: 'actors/shopify',
@@ -200,7 +201,7 @@ describe('getChangedActors', () => {
200
201
  dockerContextDir: '',
201
202
  contextPaths: [''],
202
203
  };
203
- const result = getChangedActors({
204
+ const result = await getChangedActors({
204
205
  filepathsChanged: ['actors/shopify/src/main.ts'],
205
206
  actorConfigs: [ownerlessActor],
206
207
  commits,
@@ -208,7 +209,7 @@ describe('getChangedActors', () => {
208
209
  expect(result).toEqual([ownerlessActor]);
209
210
  });
210
211
 
211
- it('in single-actor repo, .actor/ changes trigger builds', () => {
212
+ it('in single-actor repo, .actor/ changes trigger builds', async () => {
212
213
  const rootActor: ActorConfig = {
213
214
  actorFullName: 'myteam/my-actor',
214
215
  folder: '',
@@ -216,7 +217,7 @@ describe('getChangedActors', () => {
216
217
  dockerContextDir: '',
217
218
  contextPaths: [''],
218
219
  };
219
- const result = getChangedActors({
220
+ const result = await getChangedActors({
220
221
  filepathsChanged: ['.actor/actor.json'],
221
222
  actorConfigs: [rootActor],
222
223
  commits,
@@ -224,8 +225,8 @@ describe('getChangedActors', () => {
224
225
  expect(result).toEqual([rootActor]);
225
226
  });
226
227
 
227
- it('in multi-actor repo, .actor/ changes only trigger broad-context actors', () => {
228
- const result = getChangedActors({
228
+ it('in multi-actor repo, .actor/ changes only trigger broad-context actors', async () => {
229
+ const result = await getChangedActors({
229
230
  filepathsChanged: ['.actor/actor.json'],
230
231
  actorConfigs,
231
232
  commits,
@@ -233,8 +234,8 @@ describe('getChangedActors', () => {
233
234
  expect(result).toEqual([miniActor]);
234
235
  });
235
236
 
236
- it('file paths are matched case-insensitively', () => {
237
- const result = getChangedActors({
237
+ it('file paths are matched case-insensitively', async () => {
238
+ const result = await getChangedActors({
238
239
  filepathsChanged: ['Actors/FOO_BAR/Main.ts'],
239
240
  actorConfigs,
240
241
  commits,
@@ -242,7 +243,7 @@ describe('getChangedActors', () => {
242
243
  expect(result).toEqual([miniActor]);
243
244
  });
244
245
 
245
- it('triggers actor with contextPaths override when file matches an override path', () => {
246
+ it('triggers actor with contextPaths override when file matches an override path', async () => {
246
247
  const overrideActor: ActorConfig = {
247
248
  actorFullName: 'team/override-actor',
248
249
  folder: 'actors/override',
@@ -250,7 +251,7 @@ describe('getChangedActors', () => {
250
251
  dockerContextDir: 'actors/override',
251
252
  contextPaths: ['actors/override', 'packages'],
252
253
  };
253
- const result = getChangedActors({
254
+ const result = await getChangedActors({
254
255
  filepathsChanged: ['packages/shared/utils.ts'],
255
256
  actorConfigs: [overrideActor],
256
257
  commits,
@@ -258,7 +259,7 @@ describe('getChangedActors', () => {
258
259
  expect(result).toEqual([overrideActor]);
259
260
  });
260
261
 
261
- it('does not trigger actor with contextPaths override when file is outside all override paths', () => {
262
+ it('does not trigger actor with contextPaths override when file is outside all override paths', async () => {
262
263
  const overrideActor: ActorConfig = {
263
264
  actorFullName: 'team/override-actor',
264
265
  folder: 'actors/override',
@@ -266,7 +267,7 @@ describe('getChangedActors', () => {
266
267
  dockerContextDir: 'actors/override',
267
268
  contextPaths: ['actors/override', 'packages'],
268
269
  };
269
- const result = getChangedActors({
270
+ const result = await getChangedActors({
270
271
  filepathsChanged: ['other-dir/file.ts'],
271
272
  actorConfigs: [overrideActor],
272
273
  commits,
@@ -274,7 +275,7 @@ describe('getChangedActors', () => {
274
275
  expect(result).toEqual([]);
275
276
  });
276
277
 
277
- it('broad-context actor skips files in sibling actor folders', () => {
278
+ it('broad-context actor skips files in sibling actor folders', async () => {
278
279
  const actorA: ActorConfig = {
279
280
  actorFullName: 'team/actor-a',
280
281
  folder: 'actors/a',
@@ -289,7 +290,7 @@ describe('getChangedActors', () => {
289
290
  dockerContextDir: '',
290
291
  contextPaths: [''],
291
292
  };
292
- const result = getChangedActors({
293
+ const result = await getChangedActors({
293
294
  filepathsChanged: ['actors/b/src/main.ts'],
294
295
  actorConfigs: [actorA, actorB],
295
296
  commits,
@@ -297,7 +298,7 @@ describe('getChangedActors', () => {
297
298
  expect(result).toEqual([actorB]);
298
299
  });
299
300
 
300
- it('root actor (folder="") is excluded from sibling actor folder files', () => {
301
+ it('root actor (folder="") is excluded from sibling actor folder files', async () => {
301
302
  const rootActor: ActorConfig = {
302
303
  actorFullName: 'team/root',
303
304
  folder: '',
@@ -312,7 +313,7 @@ describe('getChangedActors', () => {
312
313
  dockerContextDir: 'actors/child',
313
314
  contextPaths: ['actors/child'],
314
315
  };
315
- const result = getChangedActors({
316
+ const result = await getChangedActors({
316
317
  filepathsChanged: ['actors/child/src/main.ts'],
317
318
  actorConfigs: [rootActor, childActor],
318
319
  commits,
@@ -321,7 +322,7 @@ describe('getChangedActors', () => {
321
322
  expect(result).toContainEqual(childActor);
322
323
  });
323
324
 
324
- it('root actor (folder="") sees files outside any actor folder', () => {
325
+ it('root actor (folder="") sees files outside any actor folder', async () => {
325
326
  const rootActor: ActorConfig = {
326
327
  actorFullName: 'team/root',
327
328
  folder: '',
@@ -336,7 +337,7 @@ describe('getChangedActors', () => {
336
337
  dockerContextDir: 'actors/child',
337
338
  contextPaths: ['actors/child'],
338
339
  };
339
- const result = getChangedActors({
340
+ const result = await getChangedActors({
340
341
  filepathsChanged: ['lib/shared-utils.ts'],
341
342
  actorConfigs: [rootActor, childActor],
342
343
  commits,
@@ -345,11 +346,11 @@ describe('getChangedActors', () => {
345
346
  expect(result).not.toContainEqual(childActor);
346
347
  });
347
348
 
348
- it('file matched by .dockerignore is treated as ignored', () => {
349
+ it('file matched by .dockerignore is treated as ignored', async () => {
349
350
  vi.spyOn(Dockerignore, 'loadDockerIgnore').mockReturnValue(
350
351
  (filePath) => filePath === 'actors/foo_bar/node_modules/foo.js',
351
352
  );
352
- const result = getChangedActors({
353
+ const result = await getChangedActors({
353
354
  filepathsChanged: ['actors/foo_bar/node_modules/foo.js'],
354
355
  actorConfigs: [miniActor],
355
356
  commits,
@@ -357,9 +358,9 @@ describe('getChangedActors', () => {
357
358
  expect(result).toEqual([]);
358
359
  });
359
360
 
360
- it('file not matched by .dockerignore is classified normally', () => {
361
+ it('file not matched by .dockerignore is classified normally', async () => {
361
362
  vi.spyOn(Dockerignore, 'loadDockerIgnore').mockReturnValue((filePath) => filePath.includes('node_modules'));
362
- const result = getChangedActors({
363
+ const result = await getChangedActors({
363
364
  filepathsChanged: ['actors/foo_bar/src/main.ts'],
364
365
  actorConfigs: [miniActor],
365
366
  commits,
@@ -367,9 +368,9 @@ describe('getChangedActors', () => {
367
368
  expect(result).toEqual([miniActor]);
368
369
  });
369
370
 
370
- it('JSON file in context but outside actor folder is functional (not checked for cosmetic)', () => {
371
- vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockReturnValue(true);
372
- const result = getChangedActors({
371
+ it('JSON file in context but outside actor folder is functional (not checked for cosmetic)', async () => {
372
+ vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(true);
373
+ const result = await getChangedActors({
373
374
  filepathsChanged: ['lib/config.json'],
374
375
  actorConfigs: [miniActor],
375
376
  commits,
@@ -377,8 +378,8 @@ describe('getChangedActors', () => {
377
378
  expect(result).toEqual([miniActor]);
378
379
  });
379
380
 
380
- it('README outside actor folder but inside context is ignored (not cosmetic)', () => {
381
- const result = getChangedActors({
381
+ it('README outside actor folder but inside context is ignored (not cosmetic)', async () => {
382
+ const result = await getChangedActors({
382
383
  filepathsChanged: ['docs/README.md'],
383
384
  actorConfigs: [miniActor],
384
385
  commits,
@@ -387,8 +388,8 @@ describe('getChangedActors', () => {
387
388
  expect(result).toEqual([]);
388
389
  });
389
390
 
390
- it('README inside actor folder is cosmetic', () => {
391
- const result = getChangedActors({
391
+ it('README inside actor folder is cosmetic', async () => {
392
+ const result = await getChangedActors({
392
393
  filepathsChanged: ['actors/foo_bar/README.md'],
393
394
  actorConfigs: [miniActor],
394
395
  commits,
@@ -397,8 +398,8 @@ describe('getChangedActors', () => {
397
398
  expect(result).toEqual([miniActor]);
398
399
  });
399
400
 
400
- it('hoists a standalone actor own top-level dev file relative to its context before checking the ignore list', () => {
401
- const result = getChangedActors({
401
+ it('hoists a standalone actor own top-level dev file relative to its context before checking the ignore list', async () => {
402
+ const result = await getChangedActors({
402
403
  filepathsChanged: ['standalone-actors/standalone/.eslintrc'],
403
404
  actorConfigs,
404
405
  commits,
@@ -406,8 +407,8 @@ describe('getChangedActors', () => {
406
407
  expect(result).toEqual([]);
407
408
  });
408
409
 
409
- it('does not special-case code/ and shared/ prefixes anymore — must be declared via overrideActorContext', () => {
410
- const result = getChangedActors({
410
+ it('does not special-case code/ and shared/ prefixes anymore — must be declared via overrideActorContext', async () => {
411
+ const result = await getChangedActors({
411
412
  filepathsChanged: ['code/.eslintrc'],
412
413
  actorConfigs: [miniActor],
413
414
  commits,
@@ -415,8 +416,8 @@ describe('getChangedActors', () => {
415
416
  expect(result).toEqual([miniActor]);
416
417
  });
417
418
 
418
- it('ignores code/.eslintrc when "code" is declared via overrideActorContext', () => {
419
- const result = getChangedActors({
419
+ it('ignores code/.eslintrc when "code" is declared via overrideActorContext', async () => {
420
+ const result = await getChangedActors({
420
421
  filepathsChanged: ['code/.eslintrc'],
421
422
  actorConfigs: [amazonActor],
422
423
  commits,
@@ -424,8 +425,8 @@ describe('getChangedActors', () => {
424
425
  expect(result).toEqual([]);
425
426
  });
426
427
 
427
- it('shared/Dockerfile declared via overrideActorContext is functional', () => {
428
- const result = getChangedActors({
428
+ it('shared/Dockerfile declared via overrideActorContext is functional', async () => {
429
+ const result = await getChangedActors({
429
430
  filepathsChanged: ['shared/Dockerfile'],
430
431
  actorConfigs: [amazonActor],
431
432
  commits,
@@ -433,8 +434,8 @@ describe('getChangedActors', () => {
433
434
  expect(result).toEqual([amazonActor]);
434
435
  });
435
436
 
436
- it('code/README.md declared via overrideActorContext is ignored (outside actor folder)', () => {
437
- const result = getChangedActors({
437
+ it('code/README.md declared via overrideActorContext is ignored (outside actor folder)', async () => {
438
+ const result = await getChangedActors({
438
439
  filepathsChanged: ['code/README.md'],
439
440
  actorConfigs: [amazonActor],
440
441
  commits,
@@ -446,24 +447,24 @@ describe('getChangedActors', () => {
446
447
 
447
448
  describe('getChangedActors logging', () => {
448
449
  beforeEach(() => {
449
- vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockReturnValue(false);
450
- vi.spyOn(console, 'error').mockImplementation(() => undefined);
450
+ vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(false);
451
+ vi.spyOn(logger, 'info').mockImplementation(() => undefined);
451
452
  });
452
453
 
453
- it('logs a single "specific" group for a single actor with one functional file', () => {
454
- getChangedActors({
454
+ it('logs a single "specific" group for a single actor with one functional file', async () => {
455
+ await getChangedActors({
455
456
  filepathsChanged: ['actors/foo_bar/src/main.ts'],
456
457
  actorConfigs: [miniActor],
457
458
  commits,
458
459
  });
459
460
 
460
- expect(console.error).toHaveBeenCalledWith(
461
+ expect(logger.info).toHaveBeenCalledWith(
461
462
  '[DIFF]: Changes specific to actor foo/bar: actors/foo_bar/src/main.ts',
462
463
  );
463
- expect(console.error).toHaveBeenCalledWith('[DIFF]: Actors to be built and tested: foo/bar');
464
+ expect(logger.info).toHaveBeenCalledWith('[DIFF]: Actors to be built and tested: foo/bar');
464
465
  });
465
466
 
466
- it('logs a single "shared" group when two actors are triggered by the exact same file', () => {
467
+ it('logs a single "shared" group when two actors are triggered by the exact same file', async () => {
467
468
  const actorA: ActorConfig = {
468
469
  actorFullName: 'team/actor-a',
469
470
  folder: 'actors/a',
@@ -479,20 +480,20 @@ describe('getChangedActors logging', () => {
479
480
  contextPaths: ['', 'shared'],
480
481
  };
481
482
 
482
- getChangedActors({
483
+ await getChangedActors({
483
484
  filepathsChanged: ['shared/shared.ts'],
484
485
  actorConfigs: [actorA, actorB],
485
486
  commits,
486
487
  });
487
488
 
488
- expect(console.error).toHaveBeenCalledWith(
489
+ expect(logger.info).toHaveBeenCalledWith(
489
490
  '[DIFF]: Shared changes for actors team/actor-a, team/actor-b: shared/shared.ts',
490
491
  );
491
- expect(console.error).not.toHaveBeenCalledWith(expect.stringContaining('Changes specific to actor'));
492
- expect(console.error).toHaveBeenCalledWith('[DIFF]: Actors to be built and tested: team/actor-a, team/actor-b');
492
+ expect(logger.info).not.toHaveBeenCalledWith(expect.stringContaining('Changes specific to actor'));
493
+ expect(logger.info).toHaveBeenCalledWith('[DIFF]: Actors to be built and tested: team/actor-a, team/actor-b');
493
494
  });
494
495
 
495
- it('logs shared and specific groups in descending-size order for partial overlap across actors', () => {
496
+ it('logs shared and specific groups in descending-size order for partial overlap across actors', async () => {
496
497
  const actorA: ActorConfig = {
497
498
  actorFullName: 'team/actor-a',
498
499
  folder: 'actors/a',
@@ -508,13 +509,13 @@ describe('getChangedActors logging', () => {
508
509
  contextPaths: [''],
509
510
  };
510
511
 
511
- getChangedActors({
512
+ await getChangedActors({
512
513
  filepathsChanged: ['shared.ts', 'actors/a/a-only.ts', 'actors/b/b-only.ts'],
513
514
  actorConfigs: [actorA, actorB],
514
515
  commits,
515
516
  });
516
517
 
517
- const errorCalls = (console.error as unknown as ReturnType<typeof vi.fn>).mock.calls.map((call) => call[0]);
518
+ const errorCalls = (logger.info as unknown as ReturnType<typeof vi.fn>).mock.calls.map((call) => call[0]);
518
519
 
519
520
  expect(errorCalls).toEqual([
520
521
  '[DIFF]: Shared changes for actors team/actor-a, team/actor-b: shared.ts',
@@ -524,15 +525,15 @@ describe('getChangedActors logging', () => {
524
525
  ]);
525
526
  });
526
527
 
527
- it('logs no group lines when zero actors changed', () => {
528
- getChangedActors({
528
+ it('logs no group lines when zero actors changed', async () => {
529
+ await getChangedActors({
529
530
  filepathsChanged: ['.gitignore', 'README.md'],
530
531
  actorConfigs,
531
532
  commits,
532
533
  });
533
534
 
534
- expect(console.error).not.toHaveBeenCalledWith(expect.stringContaining('Shared changes'));
535
- expect(console.error).not.toHaveBeenCalledWith(expect.stringContaining('Changes specific to'));
536
- expect(console.error).toHaveBeenCalledWith('[DIFF]: No relevant files changed, skipping builds and tests');
535
+ expect(logger.info).not.toHaveBeenCalledWith(expect.stringContaining('Shared changes'));
536
+ expect(logger.info).not.toHaveBeenCalledWith(expect.stringContaining('Changes specific to'));
537
+ expect(logger.info).toHaveBeenCalledWith('[DIFF]: No relevant files changed, skipping builds and tests');
537
538
  });
538
539
  });