apify-test-tools 0.10.2-beta.2 → 0.10.2-beta.3
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.
- package/.github/cli/apify-test-tools.mjs +124 -125
- package/CHANGELOG.md +1 -0
- package/README.md +55 -0
- package/bin/affected-actors.ts +166 -0
- package/bin/diff-changes.ts +25 -17
- package/bin/git.ts +52 -41
- package/bin/main.ts +43 -73
- package/dist/bin/affected-actors.d.ts +50 -0
- package/dist/bin/affected-actors.d.ts.map +1 -0
- package/dist/bin/affected-actors.js +89 -0
- package/dist/bin/affected-actors.js.map +1 -0
- package/dist/bin/diff-changes.d.ts +8 -2
- package/dist/bin/diff-changes.d.ts.map +1 -1
- package/dist/bin/diff-changes.js +16 -16
- package/dist/bin/diff-changes.js.map +1 -1
- package/dist/bin/git.d.ts +23 -13
- package/dist/bin/git.d.ts.map +1 -1
- package/dist/bin/git.js +44 -32
- package/dist/bin/git.js.map +1 -1
- package/dist/bin/main.js +39 -53
- package/dist/bin/main.js.map +1 -1
- package/dist/test/bundle/cli-bundle.test.js +9 -2
- package/dist/test/bundle/cli-bundle.test.js.map +1 -1
- package/dist/test/unit/bin/affected-actors.test.d.ts +2 -0
- package/dist/test/unit/bin/affected-actors.test.d.ts.map +1 -0
- package/dist/test/unit/bin/affected-actors.test.js +160 -0
- package/dist/test/unit/bin/affected-actors.test.js.map +1 -0
- package/dist/test/unit/bin/diff-changes.test.js +78 -49
- package/dist/test/unit/bin/diff-changes.test.js.map +1 -1
- package/dist/test/unit/bin/git.test.js +50 -53
- package/dist/test/unit/bin/git.test.js.map +1 -1
- package/dist/test/unit/should-built-and-test.test.js +23 -17
- package/dist/test/unit/should-built-and-test.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/test/bundle/cli-bundle.test.ts +9 -2
- package/test/unit/bin/affected-actors.test.ts +190 -0
- package/test/unit/bin/diff-changes.test.ts +87 -49
- package/test/unit/bin/git.test.ts +56 -53
- package/test/unit/should-built-and-test.test.ts +27 -17
|
@@ -41,6 +41,16 @@ const actorConfig = (
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
// What a PR (functional changes only) or a release (isLatest, all changes) builds, in config order
|
|
45
|
+
const changedActorsFor = async ({
|
|
46
|
+
isLatest = false,
|
|
47
|
+
...options
|
|
48
|
+
}: Parameters<typeof getChangedActors>[0] & { isLatest?: boolean }): Promise<ActorConfig[]> => {
|
|
49
|
+
const { functional, cosmetic } = await getChangedActors(options);
|
|
50
|
+
const changed = isLatest ? [...functional, ...cosmetic] : functional;
|
|
51
|
+
return options.actorConfigs.filter((config) => changed.includes(config));
|
|
52
|
+
};
|
|
53
|
+
|
|
44
54
|
describe('Should build and test parser', () => {
|
|
45
55
|
// From https://github.com/apify-store/testing-repo-for-github-actions
|
|
46
56
|
const ACTOR_CONFIGS: ActorConfig[] = [
|
|
@@ -70,7 +80,7 @@ describe('Should build and test parser', () => {
|
|
|
70
80
|
test('Ignores dev-only readme', async () => {
|
|
71
81
|
const FILES = ['README.md', 'code/README.md', 'shared/README.md'];
|
|
72
82
|
|
|
73
|
-
const actorsChanged = await
|
|
83
|
+
const actorsChanged = await changedActorsFor({
|
|
74
84
|
actorConfigs: ACTOR_CONFIGS,
|
|
75
85
|
isLatest: false,
|
|
76
86
|
filepathsChanged: FILES,
|
|
@@ -83,7 +93,7 @@ describe('Should build and test parser', () => {
|
|
|
83
93
|
test('Ignores other ignored files and folders', async () => {
|
|
84
94
|
const FILES = ['.vscode/settings.json', '.gitignore', '.husky/pre-commit', '.eslintrc', '.editorconfig'];
|
|
85
95
|
|
|
86
|
-
const actorsChanged = await
|
|
96
|
+
const actorsChanged = await changedActorsFor({
|
|
87
97
|
actorConfigs: ACTOR_CONFIGS,
|
|
88
98
|
isLatest: false,
|
|
89
99
|
filepathsChanged: FILES,
|
|
@@ -96,7 +106,7 @@ describe('Should build and test parser', () => {
|
|
|
96
106
|
test('.actor/ changes trigger builds for broad-context actors', async () => {
|
|
97
107
|
const FILES = ['.actor/actor.json'];
|
|
98
108
|
|
|
99
|
-
const actorsChanged = await
|
|
109
|
+
const actorsChanged = await changedActorsFor({
|
|
100
110
|
actorConfigs: ACTOR_CONFIGS,
|
|
101
111
|
isLatest: false,
|
|
102
112
|
filepathsChanged: FILES,
|
|
@@ -109,7 +119,7 @@ describe('Should build and test parser', () => {
|
|
|
109
119
|
test('Configured changelog is cosmetic for every actor, only on latest', async () => {
|
|
110
120
|
const FILES = ['CHANGELOG.md'];
|
|
111
121
|
|
|
112
|
-
const actorsChangedNotLatest = await
|
|
122
|
+
const actorsChangedNotLatest = await changedActorsFor({
|
|
113
123
|
actorConfigs: ACTOR_CONFIGS,
|
|
114
124
|
isLatest: false,
|
|
115
125
|
filepathsChanged: FILES,
|
|
@@ -117,7 +127,7 @@ describe('Should build and test parser', () => {
|
|
|
117
127
|
});
|
|
118
128
|
expect(actorsChangedNotLatest).toEqual([]);
|
|
119
129
|
|
|
120
|
-
const actorsChangedLatest = await
|
|
130
|
+
const actorsChangedLatest = await changedActorsFor({
|
|
121
131
|
actorConfigs: ACTOR_CONFIGS,
|
|
122
132
|
isLatest: true,
|
|
123
133
|
filepathsChanged: FILES,
|
|
@@ -129,7 +139,7 @@ describe('Should build and test parser', () => {
|
|
|
129
139
|
test('A changelog nested inside one actor own folder is excluded for sibling actors', async () => {
|
|
130
140
|
const FILES = ['actors/lukaskrivka_testing-github-integration-1/CHANGELOG.md'];
|
|
131
141
|
|
|
132
|
-
const actorsChanged = await
|
|
142
|
+
const actorsChanged = await changedActorsFor({
|
|
133
143
|
actorConfigs: ACTOR_CONFIGS,
|
|
134
144
|
isLatest: true,
|
|
135
145
|
filepathsChanged: FILES,
|
|
@@ -142,7 +152,7 @@ describe('Should build and test parser', () => {
|
|
|
142
152
|
test('Code updated, tests broad-context actors', async () => {
|
|
143
153
|
const FILES = ['code/src/main.ts', 'package.json'];
|
|
144
154
|
|
|
145
|
-
const actorsChanged = await
|
|
155
|
+
const actorsChanged = await changedActorsFor({
|
|
146
156
|
actorConfigs: ACTOR_CONFIGS,
|
|
147
157
|
isLatest: false,
|
|
148
158
|
filepathsChanged: FILES,
|
|
@@ -158,7 +168,7 @@ describe('Should build and test parser', () => {
|
|
|
158
168
|
'standalone-actors/lukaskrivka_test-standalone/Dockerfile',
|
|
159
169
|
];
|
|
160
170
|
|
|
161
|
-
const actorsChanged = await
|
|
171
|
+
const actorsChanged = await changedActorsFor({
|
|
162
172
|
actorConfigs: ACTOR_CONFIGS,
|
|
163
173
|
isLatest: false,
|
|
164
174
|
filepathsChanged: FILES,
|
|
@@ -171,7 +181,7 @@ describe('Should build and test parser', () => {
|
|
|
171
181
|
test('src/main.ts updated', async () => {
|
|
172
182
|
const FILES = ['src/main.ts'];
|
|
173
183
|
|
|
174
|
-
const actorsChanged = await
|
|
184
|
+
const actorsChanged = await changedActorsFor({
|
|
175
185
|
actorConfigs: ACTOR_CONFIGS,
|
|
176
186
|
isLatest: true,
|
|
177
187
|
filepathsChanged: FILES,
|
|
@@ -188,7 +198,7 @@ describe('Should build and test parser', () => {
|
|
|
188
198
|
'standalone-actors/lukaskrivka_test-standalone/Dockerfile',
|
|
189
199
|
];
|
|
190
200
|
|
|
191
|
-
const actorsChanged = await
|
|
201
|
+
const actorsChanged = await changedActorsFor({
|
|
192
202
|
actorConfigs: ACTOR_CONFIGS,
|
|
193
203
|
isLatest: false,
|
|
194
204
|
filepathsChanged: FILES,
|
|
@@ -204,7 +214,7 @@ describe('Should build and test parser', () => {
|
|
|
204
214
|
'standalone-actors/lukaskrivka_test-standalone/README.md',
|
|
205
215
|
];
|
|
206
216
|
|
|
207
|
-
const actorsChanged = await
|
|
217
|
+
const actorsChanged = await changedActorsFor({
|
|
208
218
|
actorConfigs: ACTOR_CONFIGS,
|
|
209
219
|
isLatest: false,
|
|
210
220
|
filepathsChanged: FILES,
|
|
@@ -217,7 +227,7 @@ describe('Should build and test parser', () => {
|
|
|
217
227
|
test('Actor JSON changes in PR context trigger tests', async () => {
|
|
218
228
|
const FILES = ['actors/lukaskrivka_testing-github-integration-1/.actor/actor.json'];
|
|
219
229
|
|
|
220
|
-
const actorsChanged = await
|
|
230
|
+
const actorsChanged = await changedActorsFor({
|
|
221
231
|
actorConfigs: ACTOR_CONFIGS,
|
|
222
232
|
isLatest: false,
|
|
223
233
|
filepathsChanged: FILES,
|
|
@@ -230,7 +240,7 @@ describe('Should build and test parser', () => {
|
|
|
230
240
|
test('Actor JSON changes in latest context trigger builds', async () => {
|
|
231
241
|
const FILES = ['actors/lukaskrivka_testing-github-integration-1/.actor/actor.json'];
|
|
232
242
|
|
|
233
|
-
const actorsChanged = await
|
|
243
|
+
const actorsChanged = await changedActorsFor({
|
|
234
244
|
actorConfigs: ACTOR_CONFIGS,
|
|
235
245
|
isLatest: true,
|
|
236
246
|
filepathsChanged: FILES,
|
|
@@ -243,7 +253,7 @@ describe('Should build and test parser', () => {
|
|
|
243
253
|
test('JSON file with functional changes triggers tests', async () => {
|
|
244
254
|
const FILES = ['actors/lukaskrivka_testing-github-integration-1/.actor/actor.json'];
|
|
245
255
|
|
|
246
|
-
const actorsChanged = await
|
|
256
|
+
const actorsChanged = await changedActorsFor({
|
|
247
257
|
actorConfigs: ACTOR_CONFIGS,
|
|
248
258
|
isLatest: false,
|
|
249
259
|
filepathsChanged: FILES,
|
|
@@ -259,7 +269,7 @@ describe('Should build and test parser', () => {
|
|
|
259
269
|
'actors/lukaskrivka_testing-github-integration-2/.actor/input_schema.json',
|
|
260
270
|
];
|
|
261
271
|
|
|
262
|
-
const actorsChanged = await
|
|
272
|
+
const actorsChanged = await changedActorsFor({
|
|
263
273
|
actorConfigs: ACTOR_CONFIGS,
|
|
264
274
|
isLatest: false,
|
|
265
275
|
filepathsChanged: FILES,
|
|
@@ -272,7 +282,7 @@ describe('Should build and test parser', () => {
|
|
|
272
282
|
test('Narrow-context actor JSON change in PR context triggers tests', async () => {
|
|
273
283
|
const FILES = ['standalone-actors/lukaskrivka_test-standalone/.actor/actor.json'];
|
|
274
284
|
|
|
275
|
-
const actorsChanged = await
|
|
285
|
+
const actorsChanged = await changedActorsFor({
|
|
276
286
|
actorConfigs: ACTOR_CONFIGS,
|
|
277
287
|
isLatest: false,
|
|
278
288
|
filepathsChanged: FILES,
|
|
@@ -331,7 +341,7 @@ describe('Should build and test parser', () => {
|
|
|
331
341
|
),
|
|
332
342
|
];
|
|
333
343
|
|
|
334
|
-
const actorsChanged = await
|
|
344
|
+
const actorsChanged = await changedActorsFor({
|
|
335
345
|
actorConfigs: ACTOR_CONFIGS_GOOGLE_MAPS,
|
|
336
346
|
isLatest: false,
|
|
337
347
|
filepathsChanged: FILES,
|