Documentation / @zerotal/testing / index / createTestApp
Function: createTestApp()
createTestApp(
bootstrap,setup?):Promise<TestApp>
Defined in: testing/src/TestApp.ts:551
Boot the app and start it on an OS-assigned port (port 0).
Routes must be registered in the optional setup callback (called after
reset but before start) so they are compiled into the server correctly.
Parameters
bootstrap
() => Application | Promise<Application>
setup?
() => void
Returns
Promise<TestApp>
Example
import { Application, Router } from '@zerotal/core';
import { DatabaseProvider } from '@zerotal/orm';
const app = await createTestApp(
() => Application.create({ env: 'test' }).register([DatabaseProvider]).useConfig({ database: { url: ':memory:' } }),
() => { Router.get('/ping', PingController, 'handle'); },
);