Stone.js API
    Preparing search index...
    • Replace the selected adapter's integration, and nothing else.

      A test is the same context as production minus the network: the same platform, the same response type, the same error handlers — only the thing that talks to the outside world is swapped for an in-memory one. Inventing a test platform instead was subtly wrong: adapters contribute much of what an application is through platform-conditional blueprint middleware, for instance

      if (blueprint.get('stone.adapter.platform') === NODE_HTTP_PLATFORM) {
      blueprint.set('stone.kernel.responseResolver', …) // → OutgoingHttpResponse
      }

      Under a test platform every one of those conditions is false, so the kernel built a bare OutgoingResponse. A JSON API survived it, because passing content through is all it needed; a rendered page did not, because the view layer calls response.isError(). Keeping the platform keeps all of it, for every context: HTTP, browser, edge, console, and whatever comes next.

      Adapter middleware is the one thing dropped. It exists to normalise a raw platform event — a Node IncomingMessage, a Lambda payload — and a test hands over a ready IncomingEvent, so there is nothing left for it to translate.

      Runs at priority 100, after the core selects the current adapter (0.1) and after the adapters have contributed their platform-conditional configuration (6 for the Node HTTP response resolver). That ordering is the whole mechanism.

      Parameters

      • context: BlueprintContext<IBlueprint, ClassType>

        The blueprint context.

      • next: NextMiddleware<BlueprintContext<IBlueprint, ClassType>, IBlueprint>

        The next middleware.

      Returns Promise<IBlueprint>

      The blueprint.