apify-test-tools 0.2.2 → 0.2.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.
@@ -175,7 +175,7 @@ export const extendExpect = (expect: ExpectStatic): ExpectStatic => {
175
175
  isWithinInterval(ppeDiffs, actual[ppeEvent], expected, ppeEvent as PpeEvent);
176
176
  }
177
177
 
178
- diffs.pass = ppeDiffs.pass;
178
+ diffs.pass = diffs.pass && ppeDiffs.pass;
179
179
  diffs.actual.push(ppeDiffs.actual.join('\n '));
180
180
  diffs.expected.push(ppeDiffs.expected.join('\n '));
181
181
  }
package/lib/lib.ts CHANGED
@@ -234,7 +234,17 @@ const createStartRunFn = <T>(actorNameOrId: string, testContext: TestContext) =>
234
234
  input,
235
235
  options,
236
236
  prefilledInput,
237
+ runId,
237
238
  } = runOptions;
239
+
240
+ if (runId) {
241
+ const run = await apifyClient.run(runId).get()
242
+ if (!run) {
243
+ throw new Error(`Run with id "${runId}" doesn't exist`);
244
+ }
245
+ return new RunTestResult(apifyClient, run)
246
+ }
247
+
238
248
  const actor = apifyClient.actor(actorNameOrId);
239
249
 
240
250
  const actorInput = {
package/lib/types.ts CHANGED
@@ -12,6 +12,13 @@ export type RunOptions<T> = {
12
12
  input: Omit<T, 'actorName'>
13
13
  options?: ActorCallOptions
14
14
  prefilledInput?: boolean
15
+ /**
16
+ * If you specify `runId`, all the other options will be ignored and this run's data will
17
+ * be downloaded instead.
18
+ *
19
+ * This is usefull for testing your tests on existing runs
20
+ */
21
+ runId?: string
15
22
  }
16
23
 
17
24
  export type Dataset<T> = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify-test-tools",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "description": "TBD",
6
6
  "engines": {