Skip to content

refactor(testing): rename @webiny/api-testing to @webiny/api-core-testing#5400

Merged
adrians5j merged 39 commits into
nextfrom
adrian/self-hosted-16-2026-07-09
Jul 14, 2026
Merged

refactor(testing): rename @webiny/api-testing to @webiny/api-core-testing#5400
adrians5j merged 39 commits into
nextfrom
adrian/self-hosted-16-2026-07-09

Conversation

@adrians5j

@adrians5j adrians5j commented Jul 13, 2026

Copy link
Copy Markdown
Member

What changed

Internal test-infra rename (no runtime/app impact) — step 1 of standardizing test helpers as sibling -testing packages:

  • @webiny/api-testing@webiny/api-core-testing. The base test-utils package mocks api-core's abstractions (Authenticator/Authorizer/TenantContext/IdentityContext), so the name now reflects the tier. All ~14 importers repointed; @webiny/testing re-exports the tenancy constants unchanged. Package stays api-core-only (no CMS).

Follow-ups in this series: extract createCmsTestHandler into @webiny/api-headless-cms-testing (off the api-headless-cms/testing subpath), then retire @webiny/testing.

Changelog

Renamed the base API testing package

Renamed an internal testing utilities package for clarity. No change to application behavior.

Squash Merge Commit

refactor(testing): rename api-testing to api-core-testing (#5400)

adrians5j and others added 30 commits July 8, 2026 06:36
…r-core

The WCP license refresh is a per-request RequestInitializer — a transport request-lifecycle
concern — but it lived in api-core (domain), forcing api-core to depend on @webiny/event-handler-core.

Move WcpLicenseInitializer into @webiny/api-event-handler-core (the shared API request stack) and
register it in registerApiRequestStack, so it runs for every flavour (aws + server). api-core keeps
the WCP domain (WcpLicenseProvider, WcpContext, loadWcpLicense) and now exports WcpLicenseProvider;
its @webiny/event-handler-core dependency drops to devDependencies (tests only).

Result: api-core's production layer no longer imports the transport package.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…o it

Every api package's tests copy the same TestAuthenticator/TestAuthorizer mocks, AuthTrigger/
RootTenant decorators, and createIdentity helper (~15 drifting copies). Introduce
@webiny/api-testing (deps api-core + event-handler-core) as the single home for these primitives,
using the more-evolved parameterized versions (TestIdentity/TestPermissions abstractions).

Migrate api-aco as the first consumer: delete its 5 local copies, import from @webiny/api-testing.
api-aco tests pass.

Note: the base package can't share handler *composition* (feature set differs per package) — only
the auth/tenant scaffold primitives. api-core stays on its local copies for now (it sits below this
package; consuming it would be a dev-cycle — revisit with the test-tiers split).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…-cms/testing onto it

Standardize TestPermissions on the `{ list }` holder (from the CMS harness) instead of a bare array
+ cast — DI then treats it as a single value cleanly, no `as never`. Update api-aco to register
`{ list: permissions }`.

Migrate @webiny/api-headless-cms/testing (createCmsTestHandler + re-exports) onto @webiny/api-testing;
delete its 4 local mock/decorator copies. High-leverage: every package using createCmsTestHandler
now gets the shared primitives transitively. Verified via api-aco graphql + context handlers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…2026-07-08

# Conflicts:
#	packages/api-core/src/index.ts
#	packages/api-event-handler-core/src/WcpLicenseInitializer.ts
api-scheduler: delete dead registerSchedulerExtension + createScheduler
(superseded by SchedulerFeature + SchedulerModelContextualSchema).
api-scheduler-aws/-server: convert the SchedulerService transport
ContextPlugins to RequestContextInitializer; wire aws consumer directly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
api-file-manager-server: aggregate ContextPlugin -> FileManagerServerFeature.
api-headless-cms-es-tasks: task-registration ContextPlugin ->
HeadlessCmsEsTasksFeature; migrate test harness; drop from dead api-
background-tasks-os bundle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…2026-07-09

# Conflicts:
#	packages/api-background-tasks-os/package.json
#	packages/api-background-tasks-os/src/index.ts
#	packages/api-background-tasks-os/tsconfig.build.json
#	packages/api-background-tasks-os/tsconfig.json
#	packages/api-headless-cms-es-tasks/__tests__/context/useHandler.ts
#	yarn.lock
DbFeature no longer writes ctx.db (drops the EMPTY_SCHEMA contextual schema
that existed only for that). Readers migrated to DI: db.driver.getClient()
-> resolve(DynamoDBClient).client; db.store -> resolve(DbInstance).store.
Dropped the .db type from api-websockets + api-audit-logs contexts. The
legacy dbPlugins default (test storage-preset glue) stays, documented
@deprecated, until the setupFile presets move to their own drivers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
The legacy dbPlugins (test storage-preset glue) is now a named export from
@webiny/handler-db/testing instead of the shipped default export; the two
DDB/DDB-ES setupFile.js presets import it from there. Keeps test scaffolding
out of the package's production entry. DbContext inlined into testing.ts;
types.ts removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…to DI

New HcmsBulkActionsFeature (config + 6 actions + tasks + a per-request
RequestContextInitializer for the model-derived CmsGraphQLSchemaFactory).
Eliminated the BulkActionContext service-locator bag: bulk-action tasks now
inject concrete use-cases (TasksCrud/ListTasksUseCase/TriggerTaskUseCase/
GetModelUseCase) instead of the request context.

HcmsTasksFeature now registers bulk-actions + delete-model directly (delete-
model crud/graphql ContextPlugins -> RequestContextInitializers, order
preserved for DeleteModelOperations/DisableModelFeature); deleted the
HcmsTasksInitializer bridge. ddb-es orphan re-exports the feature.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
FileManagerS3Feature now registers the S3 file-operation features + the static
S3 GraphQL schema (CoreGraphQLSchemaFactory) natively, dropping the legacy
ContextPlugin + createFileManagerS3 array. WCP-gated threat scanning moved to a
RequestContextInitializer so the canUseFileManagerThreatDetection() gate runs
after the per-request license refresh (register-time reads NullLicense and
would silently skip it).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…-2026-07-09

# Conflicts:
#	packages/cli-core/files/references.json
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
WebsiteBuilderFeature now registers all page/redirect/nextjs/nuxt features, the
static WB GraphQL (CoreGraphQLSchemaFactory), and a RequestContextInitializer
for per-request Page/Redirect model resolution — dropping the legacy
createWebsiteBuilder/createContext ContextPlugins + the bridge. setupWebsite-
BuilderModels kept for the REST route (all-transport, pre-routing) path.
Migrated the wb / wb-scheduler / wb-workflows test harnesses.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
createAuditLogs() + createAuditLogsContext() (the two legacy ContextPlugins)
were never called — the live wiring is AuditLogsFeature (registerApiRequestStack).
Deleted both, completing the #40 ContextPlugin removal for production packages.
The AuditLogsContext service-locator bag + handler DI cleanup is a separate
follow-up (facade dissection), not a ContextPlugin.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
adrians5j and others added 9 commits July 13, 2026 10:50
… to DI

createElasticsearchBackgroundTasks() (a task-registration ContextPlugin) →
ElasticsearchTasksFeature. Migrated the es-tasks + ddb-es test harnesses and
the dead api-background-tasks-os bundle (now re-exports the feature).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
createTenancyAndSecurity (4 ContextPlugins) was unused — TenancyAndSecurity-
Feature (a DI RequestContextInitializer) is the live test-harness setup.
Reduced tenancySecurity.ts to the still-used constants (defaultIdentity,
FULL_ACCESS_*/UNKNOWN_TEAM_ID). No production ContextPlugin remains; only the
class definition + bridge + test-file usages are left toward grep-zero.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…i-testing

defaultIdentity + FULL_ACCESS_*/UNKNOWN_TEAM_ID now live in the base
@webiny/api-testing package; @webiny/testing re-exports them (zero consumer
churn — the 10 barrel importers + internals keep working).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…ting

The base test-utils package mocks api-core abstractions (Authenticator/
Authorizer/TenantContext/IdentityContext), so the name should say so. First
step of standardizing on sibling -testing packages. Repointed all ~14 importers;
@webiny/testing re-exports unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg3MRCToopzWSTPWqU9Lga
…-2026-07-09

# Conflicts:
#	packages/api-core-testing/src/tenancySecurity.ts
#	packages/testing/src/context/tenancySecurity.ts
…-2026-07-09

# Conflicts:
#	packages/cli-core/files/references.json
@adrians5j

Copy link
Copy Markdown
Member Author

/vitest

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

Vitest tests have been initiated (for more information, click here). ✨

Group Status
No storage ✅ 53/53 passed
DDB ✅ 17/17 passed
DDB+OS ✅ 20/20 passed
SQL ✅ 10/10 passed

@adrians5j
adrians5j merged commit c0b59f1 into next Jul 14, 2026
40 of 51 checks passed
@adrians5j
adrians5j deleted the adrian/self-hosted-16-2026-07-09 branch July 14, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant