Skip to content

Commit

Permalink
fix: fix weird bugs when vitest is used with autoLoadEntities
Browse files Browse the repository at this point in the history
Closes #134
  • Loading branch information
B4nan committed Aug 16, 2023
1 parent 41ba27b commit cd7767a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mikro-orm.providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export function createMikroOrmProvider(contextName?: string): Provider {
return {
provide: contextName ? getMikroORMToken(contextName) : MikroORM,
useFactory: async (options?: MikroOrmModuleOptions) => {
options = { ...options };

if (options?.autoLoadEntities) {
options.entities = [...(options.entities || []), ...MikroOrmEntitiesStorage.getEntities(contextName)];
options.entitiesTs = [...(options.entitiesTs || []), ...MikroOrmEntitiesStorage.getEntities(contextName)];
Expand Down

0 comments on commit cd7767a

Please sign in to comment.