Beignet API reference
    Preparing search index...

    Function createTestApp

    • Create a Beignet route/runtime test harness.

      The harness uses @beignet/web under the hood, so tests exercise the same request parsing, route hooks, response validation, and error ownership as a Web Fetch runtime without requiring Next.js or a network listener.

      Test-friendly defaults differ from production servers in two ways, and an explicit option always wins:

      • onUnboundPorts defaults to "ignore" so apps with deferred provider ports boot without installing every provider. Reading an unbound port still throws on use.
      • mapUnhandledError defaults to a mapper that surfaces err.message in the 500 response body so failing tests show the real error.

      Type Parameters

      • Ctx
      • Ports extends AnyPorts = AnyPorts
      • ServiceInput = void
      • Routes extends readonly RouteDef<Ctx>[] = readonly RouteDef<Ctx>[]
      • Providers extends readonly AnyProvider[] = readonly AnyProvider[]
      • const TProvidedHeaders extends string = never

      Parameters

      Returns Promise<
          TestApp<
              Ctx,
              Ports & InferProviderPorts<Providers>,
              TProvidedHeaders,
              ServiceInput,
          >,
      >

      Test app with typed request(...) helpers and a bound fetch.