apify-test-tools 0.10.2-beta.7 → 0.10.2-beta.8
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/dist/lib/extend-expect.d.ts.map +1 -1
- package/dist/lib/extend-expect.js +37 -218
- package/dist/lib/extend-expect.js.map +1 -1
- package/dist/lib/lib.d.ts +1 -2
- package/dist/lib/lib.d.ts.map +1 -1
- package/dist/lib/lib.js +15 -22
- package/dist/lib/lib.js.map +1 -1
- package/dist/lib/run-checks.d.ts +14 -0
- package/dist/lib/run-checks.d.ts.map +1 -0
- package/dist/lib/run-checks.js +82 -0
- package/dist/lib/run-checks.js.map +1 -0
- package/dist/lib/run-test-result.d.ts +3 -6
- package/dist/lib/run-test-result.d.ts.map +1 -1
- package/dist/lib/run-test-result.js +41 -54
- package/dist/lib/run-test-result.js.map +1 -1
- package/dist/test/unit/run-checks.test.d.ts +2 -0
- package/dist/test/unit/run-checks.test.d.ts.map +1 -0
- package/dist/test/unit/run-checks.test.js +62 -0
- package/dist/test/unit/run-checks.test.js.map +1 -0
- package/dist/test/unit/run-test-result.test.d.ts +2 -0
- package/dist/test/unit/run-test-result.test.d.ts.map +1 -0
- package/dist/test/unit/run-test-result.test.js +34 -0
- package/dist/test/unit/run-test-result.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/extend-expect.ts +48 -258
- package/lib/lib.ts +24 -28
- package/lib/run-checks.ts +101 -0
- package/lib/run-test-result.ts +45 -55
- package/package.json +1 -1
- package/test/unit/run-checks.test.ts +76 -0
- package/test/unit/run-test-result.test.ts +44 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend-expect.d.ts","sourceRoot":"","sources":["../../lib/extend-expect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extend-expect.d.ts","sourceRoot":"","sources":["../../lib/extend-expect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,YAAY,EAAE,MAAM,QAAQ,CAAC;AAqCtD,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,KAAG,YAyDnD,CAAC"}
|
|
@@ -1,101 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inspect } from 'node:util';
|
|
2
|
+
import { checkRun } from './run-checks.js';
|
|
3
|
+
/** Matchers that only check the type or shape of a value. */
|
|
4
|
+
const SHAPE_MATCHERS = {
|
|
5
|
+
toBeArray: ['an array', (actual) => Array.isArray(actual)],
|
|
6
|
+
toBeBoolean: ['a boolean', (actual) => typeof actual === 'boolean'],
|
|
7
|
+
toBeEmptyArray: ['an empty array', (actual) => Array.isArray(actual) && actual.length === 0],
|
|
8
|
+
toBeNonEmptyArray: ['a non-empty array', (actual) => Array.isArray(actual) && actual.length > 0],
|
|
9
|
+
toBeNonEmptyString: ['a non-empty string', (actual) => typeof actual === 'string' && actual.length > 0],
|
|
10
|
+
toBeNumber: ['a number', (actual) => typeof actual === 'number'],
|
|
11
|
+
toBeFalse: ['false', (actual) => actual === false],
|
|
12
|
+
toBeTrue: ['true', (actual) => actual === true],
|
|
13
|
+
toBeNonEmptyObject: ['a non-empty object', (actual) => isObject(actual) && Object.keys(actual).length > 0],
|
|
14
|
+
toBeObject: ['an object', isObject],
|
|
15
|
+
toBeString: ['a string', (actual) => typeof actual === 'string'],
|
|
16
|
+
toBeWholeNumber: ['a whole number', (actual) => Number.isInteger(actual)],
|
|
17
|
+
};
|
|
18
|
+
function isObject(actual) {
|
|
19
|
+
return typeof actual === 'object' && !Array.isArray(actual) && actual !== null;
|
|
20
|
+
}
|
|
21
|
+
const shapeMatchers = Object.fromEntries(Object.entries(SHAPE_MATCHERS).map(([name, [description, predicate]]) => [
|
|
22
|
+
name,
|
|
23
|
+
(actual) => ({
|
|
24
|
+
pass: predicate(actual),
|
|
25
|
+
message: () => `Expected ${inspect(actual)} to be ${description}`,
|
|
26
|
+
actual,
|
|
27
|
+
}),
|
|
28
|
+
]));
|
|
2
29
|
export const extendExpect = (expect) => {
|
|
3
30
|
expect.extend({
|
|
4
|
-
|
|
5
|
-
const pass = Array.isArray(actual);
|
|
6
|
-
return {
|
|
7
|
-
pass,
|
|
8
|
-
message: () => `Expected "${actual}" to be a array`,
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
toBeBoolean: (received) => {
|
|
12
|
-
const actual = typeof received;
|
|
13
|
-
const expected = 'boolean';
|
|
14
|
-
return {
|
|
15
|
-
pass: actual === expected,
|
|
16
|
-
message: () => `Expected "${actual}" to be a boolean`,
|
|
17
|
-
expected: 'boolean',
|
|
18
|
-
};
|
|
19
|
-
},
|
|
20
|
-
toBeEmptyArray: (actual) => {
|
|
21
|
-
const pass = Array.isArray(actual) && actual.length === 0;
|
|
22
|
-
return {
|
|
23
|
-
pass,
|
|
24
|
-
message: () => `Expected ${actual} to be an empty array`,
|
|
25
|
-
actual,
|
|
26
|
-
expected: [],
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
toBeNonEmptyArray: (actual) => {
|
|
30
|
-
const pass = Array.isArray(actual) && actual.length > 0;
|
|
31
|
-
return {
|
|
32
|
-
pass,
|
|
33
|
-
message: () => `Expected ${actual} to be a non-empty array`,
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
toBeNonEmptyString: (actual) => {
|
|
37
|
-
const pass = typeof actual === 'string' && actual.length > 0;
|
|
38
|
-
return {
|
|
39
|
-
pass,
|
|
40
|
-
message: () => `Expected "${actual}" to be a non-empty string`,
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
toBeNumber: (actual) => {
|
|
44
|
-
const pass = typeof actual === 'number';
|
|
45
|
-
return {
|
|
46
|
-
pass,
|
|
47
|
-
message: () => `Expected "${actual}" to be a number`,
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
toBeNonEmptyObject: (actual) => {
|
|
51
|
-
const isObject = typeof actual === 'object' && !Array.isArray(actual) && actual !== null;
|
|
52
|
-
const isNonEmpty = Object.entries(actual).length > 0;
|
|
53
|
-
const pass = isObject && isNonEmpty;
|
|
54
|
-
return {
|
|
55
|
-
pass,
|
|
56
|
-
message: () => `Expected "${actual}" to be a non-emtpy object`,
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
toBeObject: (actual) => {
|
|
60
|
-
const pass = typeof actual === 'object' && !Array.isArray(actual) && actual !== null;
|
|
61
|
-
return {
|
|
62
|
-
pass,
|
|
63
|
-
message: () => `Expected "${actual}" to be an object`,
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
toBeString: (received) => {
|
|
67
|
-
const actual = typeof received;
|
|
68
|
-
const expected = 'string';
|
|
69
|
-
return {
|
|
70
|
-
pass: actual === expected,
|
|
71
|
-
message: () => `Expected "${actual}" to be a string`,
|
|
72
|
-
actual,
|
|
73
|
-
expected,
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
toBeTrue: (actual) => {
|
|
77
|
-
const pass = actual === true;
|
|
78
|
-
return {
|
|
79
|
-
pass,
|
|
80
|
-
message: () => `Expected "${actual}" to be true`,
|
|
81
|
-
expected: true,
|
|
82
|
-
actual,
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
toBeFalse: (actual) => {
|
|
86
|
-
const pass = actual === false;
|
|
87
|
-
return {
|
|
88
|
-
pass,
|
|
89
|
-
message: () => `Expected "${actual}" to be false`,
|
|
90
|
-
};
|
|
91
|
-
},
|
|
92
|
-
toBeWholeNumber: (received) => {
|
|
93
|
-
const pass = Number.isInteger(received);
|
|
94
|
-
return {
|
|
95
|
-
pass,
|
|
96
|
-
message: () => `Expected "${received}" to be a whole number`,
|
|
97
|
-
};
|
|
98
|
-
},
|
|
31
|
+
...shapeMatchers,
|
|
99
32
|
toBeWithinRange: (received, lower, upper) => {
|
|
100
33
|
const pass = received >= lower && received <= upper;
|
|
101
34
|
return {
|
|
@@ -104,102 +37,15 @@ export const extendExpect = (expect) => {
|
|
|
104
37
|
};
|
|
105
38
|
},
|
|
106
39
|
toFinishWith: async (received, userOptions) => {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
...userOptions,
|
|
110
|
-
};
|
|
111
|
-
const failedAssertions = [];
|
|
112
|
-
const diffs = {
|
|
113
|
-
pass: true,
|
|
114
|
-
actual: ['Run:'],
|
|
115
|
-
expected: ['Run:'],
|
|
116
|
-
};
|
|
117
|
-
{
|
|
118
|
-
const expected = options?.status;
|
|
119
|
-
const actual = received.status;
|
|
120
|
-
const statusTest = expected === actual;
|
|
121
|
-
if (statusTest === false) {
|
|
122
|
-
diffs.pass = false;
|
|
123
|
-
diffs.actual.push(`status=${actual}`);
|
|
124
|
-
diffs.expected.push(`status=${expected}`);
|
|
125
|
-
failedAssertions.push(`Failed status check, expected "${expected}", got "${actual}".`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const { chargedEventCounts, stats: { durationMillis }, } = await received.getRunInfo();
|
|
129
|
-
const datasetItemCount = (await received.getDataset()).items.length;
|
|
130
|
-
const stats = await received.getStatistics();
|
|
131
|
-
const checkInterval = (value, key, label) => {
|
|
132
|
-
const result = isWithinInterval(diffs, value, options, key);
|
|
133
|
-
if (result === false) {
|
|
134
|
-
failedAssertions.push(`Failed ${label} check, expected ${JSON.stringify(options[key])}, got ${value}.`);
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
checkInterval(datasetItemCount, 'datasetItemCount', 'dataset item count');
|
|
138
|
-
checkInterval(durationMillis, 'duration', 'duration');
|
|
139
|
-
checkInterval(stats?.requestsFailed, 'failedRequests', 'failed requests');
|
|
140
|
-
checkInterval(stats?.requestsRetries, 'requestsRetries', 'requests retries');
|
|
141
|
-
if (options.maxRetriesPerRequest !== null) {
|
|
142
|
-
const maxRetriesPerRequestObserved = (stats?.requestRetryHistogram ?? [0]).length - 1;
|
|
143
|
-
if (maxRetriesPerRequestObserved > options.maxRetriesPerRequest) {
|
|
144
|
-
diffs.pass = false;
|
|
145
|
-
diffs.actual.push(`maxRetriesPerRequest=${maxRetriesPerRequestObserved}`);
|
|
146
|
-
diffs.expected.push(`maxRetriesPerRequest<=${options.maxRetriesPerRequest}`);
|
|
147
|
-
failedAssertions.push(`Failed max retries observed check, expected <=${options.maxRetriesPerRequest}, got ${maxRetriesPerRequestObserved}.`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
const ppeDiffs = {
|
|
151
|
-
pass: true,
|
|
152
|
-
actual: ['PPE Events:'],
|
|
153
|
-
expected: ['PPE Events:'],
|
|
154
|
-
};
|
|
155
|
-
if (options.chargedEventCounts) {
|
|
156
|
-
const expected = options.chargedEventCounts;
|
|
157
|
-
const actual = chargedEventCounts ?? {};
|
|
158
|
-
const uniquePpeEvents = new Set([
|
|
159
|
-
...Array.from(Object.keys(expected)),
|
|
160
|
-
...Array.from(Object.keys(actual)),
|
|
161
|
-
]);
|
|
162
|
-
for (const ppeEvent of uniquePpeEvents) {
|
|
163
|
-
if (!(ppeEvent in expected)) {
|
|
164
|
-
isWithinInterval(ppeDiffs, actual[ppeEvent], { [ppeEvent]: 0 }, ppeEvent);
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
if (!(ppeEvent in actual)) {
|
|
168
|
-
ppeDiffs.pass = false;
|
|
169
|
-
ppeDiffs.actual.push(`${ppeEvent}=X`);
|
|
170
|
-
ppeDiffs.expected.push(`${ppeEvent}=${expected[ppeEvent]}`);
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
173
|
-
isWithinInterval(ppeDiffs, actual[ppeEvent], expected, ppeEvent);
|
|
174
|
-
}
|
|
175
|
-
if (ppeDiffs.pass === false) {
|
|
176
|
-
diffs.pass = ppeDiffs.pass;
|
|
177
|
-
diffs.actual.push(ppeDiffs.actual.join('\n '));
|
|
178
|
-
diffs.expected.push(ppeDiffs.expected.join('\n '));
|
|
179
|
-
failedAssertions.push(`Failed PPE event counts check, expected ${JSON.stringify(options.chargedEventCounts)}, got ${JSON.stringify(chargedEventCounts)}.`);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
{
|
|
183
|
-
const { forbiddenLogs } = options;
|
|
184
|
-
const log = await received.getLog();
|
|
185
|
-
const occuredLogs = [];
|
|
186
|
-
for (const forbiddenLog of forbiddenLogs) {
|
|
187
|
-
if (log.includes(forbiddenLog)) {
|
|
188
|
-
occuredLogs.push(forbiddenLog);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (occuredLogs.length > 0) {
|
|
192
|
-
diffs.pass = false;
|
|
193
|
-
diffs.actual.push(` logs=[${occuredLogs.join(', ')}]`);
|
|
194
|
-
diffs.expected.push(` logs=[]`);
|
|
195
|
-
failedAssertions.push(`Failed forbidden logs check, expected [] but got [${occuredLogs.join(', ')}].`);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
40
|
+
const checks = await checkRun(received, userOptions);
|
|
41
|
+
const failed = checks.filter(({ pass }) => !pass);
|
|
198
42
|
return {
|
|
199
|
-
pass:
|
|
200
|
-
message: () => `Run did not finish as expected. Failed assertions: ${
|
|
201
|
-
|
|
202
|
-
|
|
43
|
+
pass: failed.length === 0,
|
|
44
|
+
message: () => `Run did not finish as expected. Failed assertions: ${failed
|
|
45
|
+
.map(({ name, expected, actual }) => `Failed ${name} check, expected ${expected}, got ${actual}.`)
|
|
46
|
+
.join(' ')}`,
|
|
47
|
+
actual: ['Run:', ...failed.map(({ name, actual }) => `${name}=${actual}`)].join('\n '),
|
|
48
|
+
expected: ['Run:', ...failed.map(({ name, expected }) => `${name}=${expected}`)].join('\n '),
|
|
203
49
|
};
|
|
204
50
|
},
|
|
205
51
|
toStartWith: (received, prefix) => {
|
|
@@ -227,31 +73,4 @@ export const extendExpect = (expect) => {
|
|
|
227
73
|
};
|
|
228
74
|
return softExpect;
|
|
229
75
|
};
|
|
230
|
-
const isWithinInterval = (diffs, actual, options, intervalOption) => {
|
|
231
|
-
const expected = options[intervalOption];
|
|
232
|
-
if (expected === null) {
|
|
233
|
-
// check is disabled if expected value is null
|
|
234
|
-
return undefined;
|
|
235
|
-
}
|
|
236
|
-
if (typeof expected === 'number') {
|
|
237
|
-
if (actual !== expected) {
|
|
238
|
-
// eslint-disable-next-line no-param-reassign --- Don't want to touch this code :)
|
|
239
|
-
diffs.pass = false;
|
|
240
|
-
diffs.actual.push(`${intervalOption}=${actual}`);
|
|
241
|
-
diffs.expected.push(`${intervalOption}=${expected}`);
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
else if (typeof expected === 'object') {
|
|
246
|
-
const { min, max } = expected;
|
|
247
|
-
if (actual === undefined || (min !== undefined && actual < min) || (max !== undefined && actual > max)) {
|
|
248
|
-
// eslint-disable-next-line no-param-reassign
|
|
249
|
-
diffs.pass = false;
|
|
250
|
-
diffs.actual.push(`${intervalOption}=${actual}`);
|
|
251
|
-
diffs.expected.push(`${intervalOption}=<${min ?? ''},${max ?? ''}>`);
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return undefined;
|
|
256
|
-
};
|
|
257
76
|
//# sourceMappingURL=extend-expect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend-expect.js","sourceRoot":"","sources":["../../lib/extend-expect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extend-expect.js","sourceRoot":"","sources":["../../lib/extend-expect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAI3C,6DAA6D;AAC7D,MAAM,cAAc,GAAG;IACnB,SAAS,EAAE,CAAC,UAAU,EAAE,CAAC,MAAe,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,WAAW,EAAE,CAAC,WAAW,EAAE,CAAC,MAAe,EAAE,EAAE,CAAC,OAAO,MAAM,KAAK,SAAS,CAAC;IAC5E,cAAc,EAAE,CAAC,gBAAgB,EAAE,CAA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,KAAK,CAAC;IAC5B,CAAC;IAED,UAAU,CAAC,IAAI,GAAG,CAAI,MAAS,EAAE,OAAgB,EAAgB,EAAE;QAC/D,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC,CAAC;IAEF,OAAO,UAAqC,CAAC;AACjD,CAAC,CAAC"}
|
package/dist/lib/lib.d.ts
CHANGED
|
@@ -21,8 +21,7 @@ export declare const testActor: <T>(actorId: string, testName: string, fn: TestF
|
|
|
21
21
|
* `callStandby` function, which calls the task's `standbyUrl`.
|
|
22
22
|
*
|
|
23
23
|
* Using task is just current shortcoming of standby feature but ideally we would use Actor directly
|
|
24
|
-
|
|
25
|
-
/**
|
|
24
|
+
*
|
|
26
25
|
* @param actorId - The actor's raw platform ID or its full name (`owner/name`, e.g. `"apify/web-scraper"`).
|
|
27
26
|
*/
|
|
28
27
|
export declare const testStandbyActor: <I = any, O = any>(actorId: string, testName: string, fn: TestFunction<{
|
package/dist/lib/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../lib/lib.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,EAA8B,YAAY,EAAsB,MAAM,QAAQ,CAAC;AAItF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAc,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAuB3E,OAAO,EAAE,YAAY,EAAE,CAAC;AAaxB;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,KAAK,YAAY,CAAC,MAAM,CAAC,EAAE,UAAS,gBAAuC,SAEjH,CAAC;
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../lib/lib.ts"],"names":[],"mappings":"AAEA,OAA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CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,gBACnD,gBAAgB,SAyDP,CAAC;AAE5B;;;GAGG;AACH,QAAA,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,EAAE,aAAa,WAAW,EAAE,cAAc,WAAW,EAAE,UAAU,MAAM,MAmBvF,2BAIX,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE;;;;EAmBxF,CAAC;AAEF,UAAU,WAAW;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAClB;AA6DD,QAAA,MAAM,gBAAgB,GAAI,CAAC,EAAE,SAAS,MAAM,EAAE,aAAa,WAAW,MAKpD,YAAY,UAAU,CAAC,CAAC,CAAC,2BAwC1C,CAAC;AAMF,4BAA4B;AAE5B,eAAO,MAAM,QAAQ;gCArDK,CAAC,WAAW,MAAM,eAAe,WAAW,MAKpD,YAAY,UAAU,CAAC,CAAC,CAAC;CAgDU,CAAC"}
|
package/dist/lib/lib.js
CHANGED
|
@@ -42,21 +42,25 @@ export const describe = (name, fn, options = DEFAULT_TEST_OPTIONS) => {
|
|
|
42
42
|
vitestDescribe.runIf(!!TESTER_APIFY_TOKEN || !!RUN_ALL_PLATFORM_TESTS)(name, options, fn);
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Registers a vitest test for an Actor, which only runs when that Actor was built (or for the scheduled runs).
|
|
46
|
+
* `body` gets the test context with the soft `expect` and the full test name.
|
|
46
47
|
*/
|
|
47
|
-
|
|
48
|
+
const defineActorTest = (actorId, testName, testOptions, body) => {
|
|
48
49
|
const options = { ...DEFAULT_TEST_OPTIONS, ...testOptions };
|
|
49
50
|
const name = `${actorId}: ${testName}`;
|
|
50
51
|
// `RUN_ALL_PLATFORM_TESTS` is needed for the scheduled tests, which have no `ACTOR_BUILDS` to match the
|
|
51
52
|
// tests against - without it, every test would be filtered out as an actor we didn't build.
|
|
52
53
|
const shouldRun = !!RUN_ALL_PLATFORM_TESTS || config.has(actorId);
|
|
53
54
|
vitestTest.runIf(shouldRun)(name, options, async (context) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
await body({ ...context, expect: extendExpect(context.expect) }, name);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @param actorId - The actor's raw platform ID or its full name (`owner/name`, e.g. `"apify/web-scraper"`).
|
|
60
|
+
*/
|
|
61
|
+
export const testActor = (actorId, testName, fn, testOptions) => {
|
|
62
|
+
defineActorTest(actorId, testName, testOptions, async (context) => {
|
|
63
|
+
await fn({ ...context, run: createStartRunFn(actorId, context) });
|
|
60
64
|
});
|
|
61
65
|
};
|
|
62
66
|
/**
|
|
@@ -64,27 +68,16 @@ export const testActor = (actorId, testName, fn, testOptions) => {
|
|
|
64
68
|
* `callStandby` function, which calls the task's `standbyUrl`.
|
|
65
69
|
*
|
|
66
70
|
* Using task is just current shortcoming of standby feature but ideally we would use Actor directly
|
|
67
|
-
|
|
68
|
-
/**
|
|
71
|
+
*
|
|
69
72
|
* @param actorId - The actor's raw platform ID or its full name (`owner/name`, e.g. `"apify/web-scraper"`).
|
|
70
73
|
*/
|
|
71
74
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
75
|
export const testStandbyActor = (actorId, testName, fn, testOptions) => {
|
|
73
|
-
|
|
74
|
-
const name = `${actorId}: ${testName}`;
|
|
75
|
-
// `RUN_ALL_PLATFORM_TESTS` is needed for the scheduled tests, which have no `ACTOR_BUILDS` to match the
|
|
76
|
-
// tests against - without it, every test would be filtered out as an actor we didn't build.
|
|
77
|
-
const shouldRun = !!RUN_ALL_PLATFORM_TESTS || config.has(actorId);
|
|
78
|
-
vitestTest.runIf(shouldRun)(name, options, async (context) => {
|
|
76
|
+
defineActorTest(actorId, testName, testOptions, async (context, name) => {
|
|
79
77
|
const standbyTask = await createStandbyTask(actorId, config.get(actorId)?.buildNumber);
|
|
80
|
-
const { expect, ...rest } = context;
|
|
81
78
|
// NOTE: we wrap `fn` in try/finally so cleanup (deleting the task) always runs afterwards
|
|
82
79
|
try {
|
|
83
|
-
await fn({
|
|
84
|
-
expect: extendExpect(expect),
|
|
85
|
-
callStandby: createStartStandbyFn(standbyTask, context, name),
|
|
86
|
-
...rest,
|
|
87
|
-
});
|
|
80
|
+
await fn({ ...context, callStandby: createStartStandbyFn(standbyTask, context, name) });
|
|
88
81
|
}
|
|
89
82
|
finally {
|
|
90
83
|
const { taskId } = standbyTask;
|
package/dist/lib/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../lib/lib.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAgB,IAAI,IAAI,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEtF,OAAO,EAAE,qBAAqB,EAAE,+BAA+B,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE3D,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,IAAI,WAAW,GAAiB,EAAE,CAAC;AACnC,IAAI,CAAC;IACD,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACjD,IAAI,cAAc,EAAE,CAAC;QACjB,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACzC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,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QAEvD,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,MAAM,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;QACxD,iDAAiD;QACjD,IAAI,CAAC,IAAI,GAAG;YACR,KAAK,EAAE,GAAG,CAAC,EAAE;YACb,OAAO;YACP,OAAO,EAAE,WAAW,EAAE,aAAa,IAAI,OAAO;SACjD,CAAC;QAEF,gGAAgG;QAChG,MAAM,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAEnC,OAAO,IAAI,aAAa,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAC/C,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,GAAgC,EAAU,EAAE;IACjE,OAAO,uCAAuC,GAAG,CAAC,EAAE,EAAE,CAAC;AAC3D,CAAC,CAAC;AAEF,4BAA4B;AAC5B,gDAAgD;AAChD,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,gBAAgB,EAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RunTestResult } from './run-test-result.js';
|
|
2
|
+
import type { ToFinishWithOptions } from './types.js';
|
|
3
|
+
type Check = {
|
|
4
|
+
name: string;
|
|
5
|
+
pass: boolean;
|
|
6
|
+
actual: string;
|
|
7
|
+
expected: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Evaluates every `toFinishWith` expectation against the run, so a failing assertion reports all of them at once.
|
|
11
|
+
*/
|
|
12
|
+
export declare const checkRun: <PpeEvent extends string>(run: RunTestResult, userOptions: ToFinishWithOptions<PpeEvent>) => Promise<Check[]>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=run-checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-checks.d.ts","sourceRoot":"","sources":["../../lib/run-checks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAY,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEhE,KAAK,KAAK,GAAG;IACT,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AA6CF;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAU,QAAQ,SAAS,MAAM,EAClD,KAAK,aAAa,EAClB,aAAa,mBAAmB,CAAC,QAAQ,CAAC,KAC3C,OAAO,CAAC,KAAK,EAAE,CAwCjB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { TO_FINISH_WITH_OPTIONS } from './consts.js';
|
|
2
|
+
const isWithinInterval = (actual, interval) => {
|
|
3
|
+
if (typeof interval === 'number') {
|
|
4
|
+
return actual === interval;
|
|
5
|
+
}
|
|
6
|
+
const { min, max } = interval;
|
|
7
|
+
return actual !== undefined && (min === undefined || actual >= min) && (max === undefined || actual <= max);
|
|
8
|
+
};
|
|
9
|
+
const describeInterval = (interval) => {
|
|
10
|
+
return typeof interval === 'number' ? `${interval}` : `<${interval.min ?? ''},${interval.max ?? ''}>`;
|
|
11
|
+
};
|
|
12
|
+
const intervalCheck = (name, actual, interval) => {
|
|
13
|
+
// `null` disables the check, and so does an explicit `undefined`, e.g. from a caller forwarding an optional setting
|
|
14
|
+
if (interval == null) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
name,
|
|
20
|
+
pass: isWithinInterval(actual, interval),
|
|
21
|
+
actual: `${actual}`,
|
|
22
|
+
expected: describeInterval(interval),
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
const ppeChecks = (expected, actual = {}) => {
|
|
27
|
+
const events = new Set([...Object.keys(expected), ...Object.keys(actual)]);
|
|
28
|
+
return [...events].flatMap((event) => {
|
|
29
|
+
const name = `chargedEventCounts.${event}`;
|
|
30
|
+
// charged events the test didn't list are expected to not happen at all
|
|
31
|
+
if (!(event in expected)) {
|
|
32
|
+
return intervalCheck(name, actual[event], 0);
|
|
33
|
+
}
|
|
34
|
+
// an expected event that was never charged is a failure, even for an interval that includes 0
|
|
35
|
+
if (!(event in actual)) {
|
|
36
|
+
return [{ name, pass: false, actual: 'X', expected: describeInterval(expected[event]) }];
|
|
37
|
+
}
|
|
38
|
+
return intervalCheck(name, actual[event], expected[event]);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Evaluates every `toFinishWith` expectation against the run, so a failing assertion reports all of them at once.
|
|
43
|
+
*/
|
|
44
|
+
export const checkRun = async (run, userOptions) => {
|
|
45
|
+
const options = { ...TO_FINISH_WITH_OPTIONS, ...userOptions };
|
|
46
|
+
// The dataset's item count lags the run by 10-20 seconds, so counting the downloaded items is the only way to
|
|
47
|
+
// be in sync. Don't swap it for the count from the dataset info.
|
|
48
|
+
const [runInfo, { items }, stats, log] = await Promise.all([
|
|
49
|
+
run.getRunInfo(),
|
|
50
|
+
run.getDataset(),
|
|
51
|
+
run.getStatistics(),
|
|
52
|
+
run.getLog(),
|
|
53
|
+
]);
|
|
54
|
+
// the histogram has one bucket per retry count, so its length - 1 is the most retries any request needed
|
|
55
|
+
const maxRetriesPerRequest = (stats?.requestRetryHistogram ?? [0]).length - 1;
|
|
56
|
+
const occurredLogs = options.forbiddenLogs.filter((forbidden) => log.includes(forbidden));
|
|
57
|
+
return [
|
|
58
|
+
{ name: 'status', pass: run.status === options.status, actual: run.status, expected: options.status },
|
|
59
|
+
...intervalCheck('datasetItemCount', items.length, options.datasetItemCount),
|
|
60
|
+
...intervalCheck('duration', runInfo.stats.durationMillis, options.duration),
|
|
61
|
+
...intervalCheck('failedRequests', stats?.requestsFailed, options.failedRequests),
|
|
62
|
+
...intervalCheck('requestsRetries', stats?.requestsRetries, options.requestsRetries),
|
|
63
|
+
...(options.maxRetriesPerRequest == null
|
|
64
|
+
? []
|
|
65
|
+
: [
|
|
66
|
+
{
|
|
67
|
+
name: 'maxRetriesPerRequest',
|
|
68
|
+
pass: maxRetriesPerRequest <= options.maxRetriesPerRequest,
|
|
69
|
+
actual: `${maxRetriesPerRequest}`,
|
|
70
|
+
expected: `<=${options.maxRetriesPerRequest}`,
|
|
71
|
+
},
|
|
72
|
+
]),
|
|
73
|
+
...(options.chargedEventCounts ? ppeChecks(options.chargedEventCounts, runInfo.chargedEventCounts) : []),
|
|
74
|
+
{
|
|
75
|
+
name: 'forbiddenLogs',
|
|
76
|
+
pass: occurredLogs.length === 0,
|
|
77
|
+
actual: `[${occurredLogs.join(', ')}]`,
|
|
78
|
+
expected: '[]',
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=run-checks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-checks.js","sourceRoot":"","sources":["../../lib/run-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAWrD,MAAM,gBAAgB,GAAG,CAAC,MAA0B,EAAE,QAAkB,EAAW,EAAE;IACjF,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,MAAM,KAAK,QAAQ,CAAC;IAC/B,CAAC;IACD,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC;IAC9B,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,MAAM,IAAI,GAAG,CAAC,CAAC;AAChH,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAU,EAAE;IACpD,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C,gBAAgB,CAAC;QAC5E,GAAG,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC;QAC5E,GAAG,aAAa,CAAC,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC;QACjF,GAAG,aAAa,CAAC,iBAAiB,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,CAAC;QACpF,GAAG,CAAC,OAAO,CAAC,oBAAoB,IAAI,IAAI;YACpC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACI;oBACI,IAAI,EAAE,sBAAsB;oBAC5B,IAAI,EAAE,oBAAoB,IAAI,OAAO,CAAC,oBAAoB;oBAC1D,MAAM,EAAE,GAAG,oBAAoB,EAAE;oBACjC,QAAQ,EAAE,KAAK,OAAO,CAAC,oBAAoB,EAAE;iBAChD;aACJ,CAAC;QACR,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxG;YACI,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,YAAY,CAAC,MAAM,KAAK,CAAC;YAC/B,MAAM,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACtC,QAAQ,EAAE,IAAI;SACjB;KACJ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -3,18 +3,15 @@ import type { Dataset, SdkCrawlerStatistics } from './types.js';
|
|
|
3
3
|
export declare class RunTestResult {
|
|
4
4
|
private readonly apifyClient;
|
|
5
5
|
private readonly run;
|
|
6
|
-
private log;
|
|
7
|
-
private dataset;
|
|
8
|
-
private keyValueStoreClient;
|
|
9
|
-
private statistics;
|
|
10
|
-
private runInfo;
|
|
11
|
-
private input;
|
|
12
6
|
constructor(apifyClient: ApifyClient, run: ActorRun);
|
|
13
7
|
getStatistics: () => Promise<SdkCrawlerStatistics | undefined>;
|
|
14
8
|
getLog: () => Promise<string>;
|
|
9
|
+
private readonly datasetItems;
|
|
15
10
|
getDataset: <T>() => Promise<Dataset<T>>;
|
|
16
11
|
getKeyValueStoreClient: () => KeyValueStoreClient;
|
|
12
|
+
private readonly inputRecord;
|
|
17
13
|
getInput: <T>() => Promise<T>;
|
|
14
|
+
/** Fetches the run again, so unlike `id` and `status` it also reflects what changed after the run finished. */
|
|
18
15
|
getRunInfo: () => Promise<ActorRun>;
|
|
19
16
|
get id(): string;
|
|
20
17
|
get status(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-test-result.d.ts","sourceRoot":"","sources":["../../lib/run-test-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"run-test-result.d.ts","sourceRoot":"","sources":["../../lib/run-test-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAoBhE,qBAAa,aAAa;IAElB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,QAAQ;IAKlC,aAAa,kDAGV;IAEH,MAAM,wBAEH;IAEH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAU1B;IAEH,UAAU,GAAU,CAAC,OAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAoD;IAEjG,sBAAsB,QAAO,mBAAmB,CAE9C;IAEF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqF;IAEjH,QAAQ,GAAU,CAAC,OAAK,OAAO,CAAC,CAAC,CAAC,CAAoC;IAEtE,+GAA+G;IAC/G,UAAU,0BAEP;IAEH,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;CACJ"}
|