apify-test-tools 0.5.7-beta.4 → 0.5.7-beta.6
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/workflows/_check_code.yaml +17 -18
- package/.husky/pre-commit +13 -0
- package/CHANGELOG.md +4 -2
- package/CONTRIBUTING.md +5 -0
- package/README.md +39 -43
- package/bin/build.ts +138 -87
- package/bin/diff-changes.ts +52 -23
- package/bin/diff-json-schema.ts +10 -3
- package/bin/git.ts +31 -9
- package/bin/github.ts +7 -6
- package/bin/main.ts +14 -8
- package/bin/slack.ts +6 -2
- package/bin/test-report.ts +55 -44
- package/bin/types.ts +56 -59
- package/bin/utils.ts +17 -12
- package/dist/bin/build.d.ts +1 -1
- package/dist/bin/build.d.ts.map +1 -1
- package/dist/bin/build.js +49 -31
- package/dist/bin/build.js.map +1 -1
- package/dist/bin/diff-changes.d.ts +1 -1
- package/dist/bin/diff-changes.d.ts.map +1 -1
- package/dist/bin/diff-changes.js +15 -3
- package/dist/bin/diff-changes.js.map +1 -1
- package/dist/bin/diff-json-schema.d.ts.map +1 -1
- package/dist/bin/diff-json-schema.js +6 -1
- package/dist/bin/diff-json-schema.js.map +1 -1
- package/dist/bin/git.d.ts +7 -2
- package/dist/bin/git.d.ts.map +1 -1
- package/dist/bin/git.js +23 -6
- package/dist/bin/git.js.map +1 -1
- package/dist/bin/github.d.ts +1 -3
- package/dist/bin/github.d.ts.map +1 -1
- package/dist/bin/github.js +5 -5
- package/dist/bin/github.js.map +1 -1
- package/dist/bin/main.js +7 -1
- package/dist/bin/main.js.map +1 -1
- package/dist/bin/slack.d.ts +1 -1
- package/dist/bin/slack.d.ts.map +1 -1
- package/dist/bin/slack.js +1 -1
- package/dist/bin/slack.js.map +1 -1
- package/dist/bin/test-report.d.ts.map +1 -1
- package/dist/bin/test-report.js +9 -3
- package/dist/bin/test-report.js.map +1 -1
- package/dist/bin/types.d.ts +0 -1
- package/dist/bin/types.d.ts.map +1 -1
- package/dist/bin/utils.d.ts.map +1 -1
- package/dist/bin/utils.js +11 -7
- package/dist/bin/utils.js.map +1 -1
- package/dist/lib/extend-expect.d.ts.map +1 -1
- package/dist/lib/extend-expect.js +11 -11
- package/dist/lib/extend-expect.js.map +1 -1
- package/dist/lib/lib.d.ts +3 -2
- package/dist/lib/lib.d.ts.map +1 -1
- package/dist/lib/lib.js +7 -3
- package/dist/lib/lib.js.map +1 -1
- package/dist/lib/run-test-result.d.ts +1 -1
- package/dist/lib/run-test-result.d.ts.map +1 -1
- package/dist/lib/run-test-result.js.map +1 -1
- package/dist/lib/types.d.ts +2 -3
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +4 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/test/unit/bin/diff-changes.test.js +14 -7
- package/dist/test/unit/bin/diff-changes.test.js.map +1 -1
- package/dist/test/unit/bin/diff.test.js +14 -4
- package/dist/test/unit/bin/diff.test.js.map +1 -1
- package/dist/test/unit/bin/git.test.js +48 -19
- package/dist/test/unit/bin/git.test.js.map +1 -1
- package/dist/test/unit/custom-matchers.test.js +3 -8
- package/dist/test/unit/custom-matchers.test.js.map +1 -1
- package/dist/test/unit/should-built-and-test.test.js +75 -18
- package/dist/test/unit/should-built-and-test.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eslint.config.mjs +4 -2
- package/knip.json +1 -1
- package/lib/extend-expect.ts +21 -21
- package/lib/lib.ts +17 -17
- package/lib/run-test-result.ts +6 -2
- package/lib/types.ts +5 -8
- package/lib/utils.ts +13 -9
- package/package.json +10 -3
- package/test/tsconfig.json +2 -4
- package/test/unit/bin/diff-changes.test.ts +14 -7
- package/test/unit/bin/diff.test.ts +19 -21
- package/test/unit/bin/git.test.ts +59 -20
- package/test/unit/custom-matchers.test.ts +10 -9
- package/test/unit/should-built-and-test.test.ts +77 -20
- package/bin/consts.ts +0 -6
- package/dist/bin/consts.d.ts +0 -4
- package/dist/bin/consts.d.ts.map +0 -1
- package/dist/bin/consts.js +0 -6
- package/dist/bin/consts.js.map +0 -1
- package/example-github-events/pull-request.json +0 -523
- package/example-github-events/push.json +0 -216
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import process from 'process';
|
|
2
|
-
import { describe } from 'vitest';
|
|
1
|
+
import process from 'node:process';
|
|
3
2
|
|
|
4
3
|
import { ApifyClient } from 'apify-client';
|
|
4
|
+
import { describe } from 'vitest';
|
|
5
|
+
|
|
5
6
|
import { testStandbyActor, testTestActor } from '../../lib/lib.js';
|
|
6
7
|
import { RunTestResult } from '../../lib/run-test-result.js';
|
|
7
8
|
|
|
@@ -11,13 +12,13 @@ enum PpeEventEnum {
|
|
|
11
12
|
SEARCH_PAGE_SCRAPED = 'search-page-scraped',
|
|
12
13
|
ADS_SCRAPED = 'ads-scraped',
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
ACTOR_START: 'actor-start'
|
|
16
|
-
ITEM_PUSHED: 'search-page-scraped'
|
|
17
|
-
ADS_SCRAPED: 'ads-scraped'
|
|
18
|
-
}
|
|
15
|
+
type PPE_EVENT_CONST = {
|
|
16
|
+
ACTOR_START: 'actor-start';
|
|
17
|
+
ITEM_PUSHED: 'search-page-scraped';
|
|
18
|
+
ADS_SCRAPED: 'ads-scraped';
|
|
19
|
+
};
|
|
19
20
|
|
|
20
|
-
// TODO: Remake these tests. k5MNKmaDGHlABDn2I run doesn't exist and we probably don't want to depend on fixed run
|
|
21
|
+
// TODO: Remake these tests. k5MNKmaDGHlABDn2I run doesn't exist and we probably don't want to depend on fixed run
|
|
21
22
|
describe.skip('custom-matchers', { timeout: 100_000 }, () => {
|
|
22
23
|
testTestActor('basic', async ({ expect }) => {
|
|
23
24
|
const apifyClient = new ApifyClient({ token: process.env.TESTER_APIFY_TOKEN });
|
|
@@ -43,7 +44,7 @@ describe.skip('custom-matchers', { timeout: 100_000 }, () => {
|
|
|
43
44
|
},
|
|
44
45
|
});
|
|
45
46
|
|
|
46
|
-
await expect(runResult).toFinishWith<
|
|
47
|
+
await expect(runResult).toFinishWith<PPE_EVENT_CONST[keyof PPE_EVENT_CONST]>({
|
|
47
48
|
datasetItemCount: { min: 1, max: 20 },
|
|
48
49
|
chargedEventCounts: {
|
|
49
50
|
'actor-start': 1,
|
|
@@ -40,7 +40,12 @@ describe('Should build and test parser', () => {
|
|
|
40
40
|
test('Ignores dev-only readme', () => {
|
|
41
41
|
const FILES = ['README.md', 'code/README.md', 'shared/README.md'];
|
|
42
42
|
|
|
43
|
-
const actorsChanged = getChangedActors({
|
|
43
|
+
const actorsChanged = getChangedActors({
|
|
44
|
+
actorConfigs: ACTOR_CONFIGS,
|
|
45
|
+
isLatest: false,
|
|
46
|
+
filepathsChanged: FILES,
|
|
47
|
+
commits,
|
|
48
|
+
});
|
|
44
49
|
|
|
45
50
|
expect(actorsChanged).toEqual([]);
|
|
46
51
|
});
|
|
@@ -48,7 +53,12 @@ describe('Should build and test parser', () => {
|
|
|
48
53
|
test('Ignores other ignored files and folders', () => {
|
|
49
54
|
const FILES = ['.vscode/', '.gitignore', '.husky/', '.eslintrc', '.editorconfig', '.actor/'];
|
|
50
55
|
|
|
51
|
-
const actorsChanged = getChangedActors({
|
|
56
|
+
const actorsChanged = getChangedActors({
|
|
57
|
+
actorConfigs: ACTOR_CONFIGS,
|
|
58
|
+
isLatest: false,
|
|
59
|
+
filepathsChanged: FILES,
|
|
60
|
+
commits,
|
|
61
|
+
});
|
|
52
62
|
|
|
53
63
|
expect(actorsChanged).toEqual([]);
|
|
54
64
|
});
|
|
@@ -56,7 +66,12 @@ describe('Should build and test parser', () => {
|
|
|
56
66
|
test('Only builds latest for all Actors', () => {
|
|
57
67
|
const FILES = ['shared/CHANGELOG.md', 'CHANGELOG.md'];
|
|
58
68
|
|
|
59
|
-
const actorsChanged = getChangedActors({
|
|
69
|
+
const actorsChanged = getChangedActors({
|
|
70
|
+
actorConfigs: ACTOR_CONFIGS,
|
|
71
|
+
isLatest: true,
|
|
72
|
+
filepathsChanged: FILES,
|
|
73
|
+
commits,
|
|
74
|
+
});
|
|
60
75
|
|
|
61
76
|
expect(actorsChanged).toEqual(ACTOR_CONFIGS.filter(({ isStandalone }) => !isStandalone));
|
|
62
77
|
});
|
|
@@ -64,26 +79,42 @@ describe('Should build and test parser', () => {
|
|
|
64
79
|
test('Code updated, tests miniactors', () => {
|
|
65
80
|
const FILES = ['code/src/main.ts', 'package.json'];
|
|
66
81
|
|
|
67
|
-
const actorsChanged = getChangedActors({
|
|
82
|
+
const actorsChanged = getChangedActors({
|
|
83
|
+
actorConfigs: ACTOR_CONFIGS,
|
|
84
|
+
isLatest: false,
|
|
85
|
+
filepathsChanged: FILES,
|
|
86
|
+
commits,
|
|
87
|
+
});
|
|
68
88
|
|
|
69
89
|
expect(actorsChanged).toEqual(ACTOR_CONFIGS.filter(({ isStandalone }) => !isStandalone));
|
|
70
90
|
});
|
|
71
91
|
|
|
72
92
|
test('Specific Actor functionality configs updated', () => {
|
|
73
|
-
const FILES = [
|
|
93
|
+
const FILES = [
|
|
94
|
+
'actors/lukaskrivka_testing-github-integration-1/.actor/actor.json',
|
|
95
|
+
'standalone-actors/lukaskrivka_test-standalone/Dockerfile',
|
|
96
|
+
];
|
|
74
97
|
// Default mock returns false = functional change
|
|
75
98
|
|
|
76
|
-
const actorsChanged = getChangedActors({
|
|
99
|
+
const actorsChanged = getChangedActors({
|
|
100
|
+
actorConfigs: ACTOR_CONFIGS,
|
|
101
|
+
isLatest: false,
|
|
102
|
+
filepathsChanged: FILES,
|
|
103
|
+
commits,
|
|
104
|
+
});
|
|
77
105
|
|
|
78
106
|
expect(actorsChanged).toEqual([ACTOR_CONFIGS[0], ACTOR_CONFIGS[2]]);
|
|
79
107
|
});
|
|
80
108
|
|
|
81
109
|
test('src/main.ts updated', () => {
|
|
82
|
-
const FILES = [
|
|
83
|
-
'src/main.ts',
|
|
84
|
-
];
|
|
110
|
+
const FILES = ['src/main.ts'];
|
|
85
111
|
|
|
86
|
-
const actorsChanged = getChangedActors({
|
|
112
|
+
const actorsChanged = getChangedActors({
|
|
113
|
+
actorConfigs: ACTOR_CONFIGS,
|
|
114
|
+
isLatest: true,
|
|
115
|
+
filepathsChanged: FILES,
|
|
116
|
+
commits,
|
|
117
|
+
});
|
|
87
118
|
|
|
88
119
|
expect(actorsChanged).toEqual(ACTOR_CONFIGS.slice(0, 2));
|
|
89
120
|
});
|
|
@@ -96,15 +127,28 @@ describe('Should build and test parser', () => {
|
|
|
96
127
|
];
|
|
97
128
|
// Default mock returns false = functional change for the JSON file
|
|
98
129
|
|
|
99
|
-
const actorsChanged = getChangedActors({
|
|
130
|
+
const actorsChanged = getChangedActors({
|
|
131
|
+
actorConfigs: ACTOR_CONFIGS,
|
|
132
|
+
isLatest: false,
|
|
133
|
+
filepathsChanged: FILES,
|
|
134
|
+
commits,
|
|
135
|
+
});
|
|
100
136
|
|
|
101
137
|
expect(actorsChanged).toEqual(ACTOR_CONFIGS);
|
|
102
138
|
});
|
|
103
139
|
|
|
104
140
|
test('Specific Actor non-functional configs updated', () => {
|
|
105
|
-
const FILES = [
|
|
141
|
+
const FILES = [
|
|
142
|
+
'actors/lukaskrivka_testing-github-integration-2/.actor/README.md',
|
|
143
|
+
'standalone-actors/lukaskrivka_test-standalone/CHANGELOG.md',
|
|
144
|
+
];
|
|
106
145
|
|
|
107
|
-
const actorsChanged = getChangedActors({
|
|
146
|
+
const actorsChanged = getChangedActors({
|
|
147
|
+
actorConfigs: ACTOR_CONFIGS,
|
|
148
|
+
isLatest: false,
|
|
149
|
+
filepathsChanged: FILES,
|
|
150
|
+
commits,
|
|
151
|
+
});
|
|
108
152
|
|
|
109
153
|
expect(actorsChanged).toEqual([]);
|
|
110
154
|
});
|
|
@@ -157,8 +201,8 @@ describe('Should build and test parser', () => {
|
|
|
157
201
|
'actors/lukaskrivka_testing-github-integration-2/.actor/input_schema.json',
|
|
158
202
|
];
|
|
159
203
|
// Actor 1 JSON is cosmetic-only, actor 2 JSON is functional
|
|
160
|
-
isCosmeticOnlyJsonSchemaSpy.mockImplementation(
|
|
161
|
-
!filepath.includes('input_schema.json'),
|
|
204
|
+
isCosmeticOnlyJsonSchemaSpy.mockImplementation(
|
|
205
|
+
(_commits, filepath: string) => !filepath.includes('input_schema.json'),
|
|
162
206
|
);
|
|
163
207
|
|
|
164
208
|
const actorsChanged = getChangedActors({
|
|
@@ -187,10 +231,20 @@ describe('Should build and test parser', () => {
|
|
|
187
231
|
});
|
|
188
232
|
|
|
189
233
|
test('Google Maps real user-case that had undefined', () => {
|
|
190
|
-
const FILES = [
|
|
191
|
-
'
|
|
192
|
-
'
|
|
193
|
-
'code/src/
|
|
234
|
+
const FILES = [
|
|
235
|
+
'actors/compass_Google-Maps-Reviews-Scraper/.actor/INPUT_SCHEMA.json',
|
|
236
|
+
'actors/compass_crawler-google-places/.actor/INPUT_SCHEMA.json',
|
|
237
|
+
'code/src/consts.ts',
|
|
238
|
+
'code/src/crawlers/cheerio/routes.ts',
|
|
239
|
+
'code/src/detail_page_handle.ts',
|
|
240
|
+
'code/src/enqueue_places.ts',
|
|
241
|
+
'code/src/helper-classes/initialize-all.ts',
|
|
242
|
+
'code/src/helper-classes/stats.ts',
|
|
243
|
+
'code/src/helper-classes/unmatched-categories.ts',
|
|
244
|
+
'code/src/main.ts',
|
|
245
|
+
'code/src/typedefs/general.ts',
|
|
246
|
+
'code/src/utils/background-enqueue.ts',
|
|
247
|
+
];
|
|
194
248
|
|
|
195
249
|
const ACTOR_CONFIGS_GOOGLE_MAPS: ActorConfig[] = [
|
|
196
250
|
{
|
|
@@ -242,7 +296,10 @@ describe('Should build and test parser', () => {
|
|
|
242
296
|
];
|
|
243
297
|
|
|
244
298
|
const actorsChanged = getChangedActors({
|
|
245
|
-
actorConfigs: ACTOR_CONFIGS_GOOGLE_MAPS,
|
|
299
|
+
actorConfigs: ACTOR_CONFIGS_GOOGLE_MAPS,
|
|
300
|
+
isLatest: false,
|
|
301
|
+
filepathsChanged: FILES,
|
|
302
|
+
commits,
|
|
246
303
|
});
|
|
247
304
|
|
|
248
305
|
expect(actorsChanged).toEqual(ACTOR_CONFIGS_GOOGLE_MAPS.filter(({ isStandalone }) => !isStandalone));
|
package/bin/consts.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Technically, upgrades in shared or packages might not need impact every actor
|
|
2
|
-
// but we cannot really know that
|
|
3
|
-
export const DEFAULT_BUILD_ALL_FOLDERS = ['code', 'shared', 'packages'];
|
|
4
|
-
|
|
5
|
-
export const PERSISTED_GH_JOBS_KVS_ID = 'XIBdO8EJePdD0KiAI';
|
|
6
|
-
export const MINIACTORS_LIST_STORE_ID = 'ftXklt2f2mN30Oc3y';
|
package/dist/bin/consts.d.ts
DELETED
package/dist/bin/consts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../bin/consts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,UAAiC,CAAC;AAExE,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAC5D,eAAO,MAAM,wBAAwB,sBAAsB,CAAC"}
|
package/dist/bin/consts.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Technically, upgrades in shared or packages might not need impact every actor
|
|
2
|
-
// but we cannot really know that
|
|
3
|
-
export const DEFAULT_BUILD_ALL_FOLDERS = ['code', 'shared', 'packages'];
|
|
4
|
-
export const PERSISTED_GH_JOBS_KVS_ID = 'XIBdO8EJePdD0KiAI';
|
|
5
|
-
export const MINIACTORS_LIST_STORE_ID = 'ftXklt2f2mN30Oc3y';
|
|
6
|
-
//# sourceMappingURL=consts.js.map
|
package/dist/bin/consts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../bin/consts.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iCAAiC;AACjC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC"}
|