From b513989f042b23dbc2b35c2ef34ab3ee0dd88d79 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 20 Aug 2026 11:30:28 +0000 Subject: [PATCH 1/3] feat!: gate platform tests on TESTER_APIFY_TOKEN instead of RUN_PLATFORM_TESTS Platform test suites now run whenever a tester token is present, so there is no separate opt-in flag to remember. RUN_ALL_PLATFORM_TESTS keeps working as before. Closes #121 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01JSd2mJ6ZFg8cf7dRg4nTQg --- README.md | 4 +--- lib/lib.ts | 7 +++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 84ceeb9..f3f4c4b 100644 --- a/README.md +++ b/README.md @@ -439,14 +439,13 @@ Since you already scoped the build to just the Actor(s) you care about, point vi #### 5. Run tests against the builds -Pass the build output as `ACTOR_BUILDS` and provide `TESTER_APIFY_TOKEN`. The token can point to your own account (if you have enough memory) or you can use the testing account (xRGg9iAfJSymqartk). +Pass the build output as `ACTOR_BUILDS` and provide `TESTER_APIFY_TOKEN`. The token can point to your own account (if you have enough memory) or you can use the testing account (xRGg9iAfJSymqartk). Platform test suites are skipped unless `TESTER_APIFY_TOKEN` is set, so regular unit test runs stay unaffected. If you want to run only certain tests, change the `test/platform` to be more specific. ```bash ACTOR_BUILDS='' \ TESTER_APIFY_TOKEN= \ -RUN_PLATFORM_TESTS=1 \ npx vitest --run --maxConcurrency 20 --fileParallelism=true --maxWorkers 100 test/platform ``` @@ -463,7 +462,6 @@ BUILDS=$(APIFY_TOKEN_JOHN_DOE=apify_api_xxx \ # Run tests with the builds ACTOR_BUILDS="$BUILDS" \ TESTER_APIFY_TOKEN=apify_api_yyy \ -RUN_PLATFORM_TESTS=1 \ npx vitest --run --maxConcurrency 20 --fileParallelism=true --maxWorkers 100 test/platform ``` diff --git a/lib/lib.ts b/lib/lib.ts index 5c83f31..1d6b554 100644 --- a/lib/lib.ts +++ b/lib/lib.ts @@ -31,7 +31,7 @@ const config = actorBuilds.reduce>((map, cfg) => { export { ExpectStatic }; -const { TESTER_APIFY_TOKEN, RUN_PLATFORM_TESTS, RUN_ALL_PLATFORM_TESTS } = process.env; +const { TESTER_APIFY_TOKEN, RUN_ALL_PLATFORM_TESTS } = process.env; const apifyClient = new ApifyClient({ token: TESTER_APIFY_TOKEN }); const DEFAULT_TEST_OPTIONS: ActorTestOptions = { @@ -41,8 +41,11 @@ const DEFAULT_TEST_OPTIONS: ActorTestOptions = { timeout: DEFAULT_TEST_RUN_DURATION_MS, }; +/** + * Platform tests only run when `TESTER_APIFY_TOKEN` is provided, since they need the platform to run against. + */ export const describe = (name: string, fn?: SuiteFactory, options: ActorTestOptions = DEFAULT_TEST_OPTIONS) => { - vitestDescribe.runIf(!!RUN_PLATFORM_TESTS || !!RUN_ALL_PLATFORM_TESTS)(name, options, fn); + vitestDescribe.runIf(!!TESTER_APIFY_TOKEN || !!RUN_ALL_PLATFORM_TESTS)(name, options, fn); }; const DEFAULT_TEST_ACTOR_OPTIONS: ActorTestOptions = { From 081452c48ba6e6bfda261334ea5af9e205f8b096 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 20 Aug 2026 12:38:07 +0000 Subject: [PATCH 2/3] docs: explain why RUN_ALL_PLATFORM_TESTS exists Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01JSd2mJ6ZFg8cf7dRg4nTQg --- lib/lib.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/lib.ts b/lib/lib.ts index 1d6b554..4c2c8e9 100644 --- a/lib/lib.ts +++ b/lib/lib.ts @@ -43,6 +43,9 @@ const DEFAULT_TEST_OPTIONS: ActorTestOptions = { /** * Platform tests only run when `TESTER_APIFY_TOKEN` is provided, since they need the platform to run against. + * + * `RUN_ALL_PLATFORM_TESTS` is needed for periodic tests, where there is no `ACTOR_BUILDS` env var to match + * the tests against - without it, every `testActor` would be filtered out as an actor we didn't build. */ export const describe = (name: string, fn?: SuiteFactory, options: ActorTestOptions = DEFAULT_TEST_OPTIONS) => { vitestDescribe.runIf(!!TESTER_APIFY_TOKEN || !!RUN_ALL_PLATFORM_TESTS)(name, options, fn); From 7e7d6d771561eec361289d5127bbdbd5ea4c7b8c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 21 Aug 2026 08:27:09 +0000 Subject: [PATCH 3/3] docs: clarify why RUN_ALL_PLATFORM_TESTS is checked in each place Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01JSd2mJ6ZFg8cf7dRg4nTQg --- lib/lib.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/lib.ts b/lib/lib.ts index 4c2c8e9..7756bde 100644 --- a/lib/lib.ts +++ b/lib/lib.ts @@ -42,10 +42,10 @@ const DEFAULT_TEST_OPTIONS: ActorTestOptions = { }; /** - * Platform tests only run when `TESTER_APIFY_TOKEN` is provided, since they need the platform to run against. + * Platform tests need `TESTER_APIFY_TOKEN` to talk to the platform, so without it we skip them altogether. * - * `RUN_ALL_PLATFORM_TESTS` is needed for periodic tests, where there is no `ACTOR_BUILDS` env var to match - * the tests against - without it, every `testActor` would be filtered out as an actor we didn't build. + * `RUN_ALL_PLATFORM_TESTS` enables them too because locally we can test against a hardcoded `runId`, + * which doesn't need the tester token. */ export const describe = (name: string, fn?: SuiteFactory, options: ActorTestOptions = DEFAULT_TEST_OPTIONS) => { vitestDescribe.runIf(!!TESTER_APIFY_TOKEN || !!RUN_ALL_PLATFORM_TESTS)(name, options, fn); @@ -71,6 +71,8 @@ export const testActor = ( ...testOptions, }; const name = `${actorId}: ${testName}`; + // `RUN_ALL_PLATFORM_TESTS` is needed for the scheduled tests, which have no `ACTOR_BUILDS` to match the + // tests against - without it, every test would be filtered out as an actor we didn't build. const shouldRun = !!RUN_ALL_PLATFORM_TESTS || config.has(actorId); vitestTest.runIf(shouldRun)(name, options, async (context: TYPE) => { const { expect, ...rest } = context; @@ -103,6 +105,8 @@ export const testStandbyActor = ( ...testOptions, }; const name = `${actorId}: ${testName}`; + // `RUN_ALL_PLATFORM_TESTS` is needed for the scheduled tests, which have no `ACTOR_BUILDS` to match the + // tests against - without it, every test would be filtered out as an actor we didn't build. const shouldRun = !!RUN_ALL_PLATFORM_TESTS || config.has(actorId); vitestTest.runIf(shouldRun)(name, options, async (context: T) => {