---
title: "RegisterInitializer"
generated: true
---
<GenerationInfo sourceFile="packages/testing/src/initializers/initializers.ts" sourceLine="16" packageName="@vendure/testing" />

Registers a <DocsLink href="/reference/typescript-api/testing/test-db-initializer#testdbinitializer">TestDbInitializer</DocsLink> for the given database type. Should be called before invoking
<DocsLink href="/reference/typescript-api/testing/create-test-environment#createtestenvironment">createTestEnvironment</DocsLink>.

```ts title="Signature"
function registerInitializer(type: DataSourceOptions['type'], initializer: TestDbInitializer<any>): void
```
Parameters

### type

<MemberInfo kind="parameter" type={`DataSourceOptions['type']`} />

### initializer

<MemberInfo kind="parameter" type={`<a href='/reference/typescript-api/testing/test-db-initializer#testdbinitializer'>TestDbInitializer</a><any>`} />

