apify-test-tools 0.9.1-beta.2 → 0.9.1-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/README.md +1 -3
- package/dist/lib/lib.d.ts +6 -0
- package/dist/lib/lib.d.ts.map +1 -1
- package/dist/lib/lib.js +12 -2
- package/dist/lib/lib.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/lib.ts +12 -2
- package/package.json +1 -1
package/lib/lib.ts
CHANGED
|
@@ -31,7 +31,7 @@ const config = actorBuilds.reduce<Map<string, ActorBuild>>((map, cfg) => {
|
|
|
31
31
|
|
|
32
32
|
export { ExpectStatic };
|
|
33
33
|
|
|
34
|
-
const { TESTER_APIFY_TOKEN,
|
|
34
|
+
const { TESTER_APIFY_TOKEN, RUN_ALL_PLATFORM_TESTS } = process.env;
|
|
35
35
|
const apifyClient = new ApifyClient({ token: TESTER_APIFY_TOKEN });
|
|
36
36
|
|
|
37
37
|
const DEFAULT_TEST_OPTIONS: ActorTestOptions = {
|
|
@@ -41,8 +41,14 @@ const DEFAULT_TEST_OPTIONS: ActorTestOptions = {
|
|
|
41
41
|
timeout: DEFAULT_TEST_RUN_DURATION_MS,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Platform tests need `TESTER_APIFY_TOKEN` to talk to the platform, so without it we skip them altogether.
|
|
46
|
+
*
|
|
47
|
+
* `RUN_ALL_PLATFORM_TESTS` enables them too because locally we can test against a hardcoded `runId`,
|
|
48
|
+
* which doesn't need the tester token.
|
|
49
|
+
*/
|
|
44
50
|
export const describe = (name: string, fn?: SuiteFactory<object>, options: ActorTestOptions = DEFAULT_TEST_OPTIONS) => {
|
|
45
|
-
vitestDescribe.runIf(!!
|
|
51
|
+
vitestDescribe.runIf(!!TESTER_APIFY_TOKEN || !!RUN_ALL_PLATFORM_TESTS)(name, options, fn);
|
|
46
52
|
};
|
|
47
53
|
|
|
48
54
|
const DEFAULT_TEST_ACTOR_OPTIONS: ActorTestOptions = {
|
|
@@ -65,6 +71,8 @@ export const testActor = <T>(
|
|
|
65
71
|
...testOptions,
|
|
66
72
|
};
|
|
67
73
|
const name = `${actorId}: ${testName}`;
|
|
74
|
+
// `RUN_ALL_PLATFORM_TESTS` is needed for the scheduled tests, which have no `ACTOR_BUILDS` to match the
|
|
75
|
+
// tests against - without it, every test would be filtered out as an actor we didn't build.
|
|
68
76
|
const shouldRun = !!RUN_ALL_PLATFORM_TESTS || config.has(actorId);
|
|
69
77
|
vitestTest.runIf(shouldRun)(name, options, async <TYPE extends TestContext>(context: TYPE) => {
|
|
70
78
|
const { expect, ...rest } = context;
|
|
@@ -97,6 +105,8 @@ export const testStandbyActor = <I = any, O = any>(
|
|
|
97
105
|
...testOptions,
|
|
98
106
|
};
|
|
99
107
|
const name = `${actorId}: ${testName}`;
|
|
108
|
+
// `RUN_ALL_PLATFORM_TESTS` is needed for the scheduled tests, which have no `ACTOR_BUILDS` to match the
|
|
109
|
+
// tests against - without it, every test would be filtered out as an actor we didn't build.
|
|
100
110
|
const shouldRun = !!RUN_ALL_PLATFORM_TESTS || config.has(actorId);
|
|
101
111
|
|
|
102
112
|
vitestTest.runIf(shouldRun)(name, options, async <T extends TestContext>(context: T) => {
|