diff --git a/integration/module-utils/src/integration.module-definition.ts b/integration/module-utils/src/integration.module-definition.ts index 9965abb8751..89d7a984241 100644 --- a/integration/module-utils/src/integration.module-definition.ts +++ b/integration/module-utils/src/integration.module-definition.ts @@ -1,7 +1,7 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; import { IntegrationModuleOptions } from './interfaces/integration-module-options.interface'; -export const { ConfigurableModuleClass, initialize, MODULE_OPTIONS_TOKEN } = +export const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } = new ConfigurableModuleBuilder() .setClassMethodName('forRoot') .setFactoryMethodName('construct') diff --git a/integration/module-utils/src/integration.module.ts b/integration/module-utils/src/integration.module.ts index de3788bd054..3b994f4bd4f 100644 --- a/integration/module-utils/src/integration.module.ts +++ b/integration/module-utils/src/integration.module.ts @@ -1,15 +1,12 @@ import { Inject, Module } from '@nestjs/common'; import { ConfigurableModuleClass, - initialize, MODULE_OPTIONS_TOKEN, } from './integration.module-definition'; import { IntegrationModuleOptions } from './interfaces/integration-module-options.interface'; @Module({}) export class IntegrationModule extends ConfigurableModuleClass { - static module = initialize(IntegrationModule); - constructor( @Inject(MODULE_OPTIONS_TOKEN) public readonly options: IntegrationModuleOptions, diff --git a/packages/common/test/module-utils/configurable-module.builder.spec.ts b/packages/common/test/module-utils/configurable-module.builder.spec.ts index 0f7891b797b..3d36232718a 100644 --- a/packages/common/test/module-utils/configurable-module.builder.spec.ts +++ b/packages/common/test/module-utils/configurable-module.builder.spec.ts @@ -5,18 +5,15 @@ import { ConfigurableModuleBuilder } from '../../module-utils'; describe('ConfigurableModuleBuilder', () => { describe('setExtras', () => { it('should apply module definition transformer function and return typed builder', () => { - const { ConfigurableModuleClass, initialize } = - new ConfigurableModuleBuilder() - .setExtras( - { isGlobal: false }, - (definition, extras: { isGlobal: boolean }) => ({ - ...definition, - global: extras.isGlobal, - }), - ) - .build(); - - initialize(class {}); + const { ConfigurableModuleClass } = new ConfigurableModuleBuilder() + .setExtras( + { isGlobal: false }, + (definition, extras: { isGlobal: boolean }) => ({ + ...definition, + global: extras.isGlobal, + }), + ) + .build(); expect( ConfigurableModuleClass.register({ @@ -30,10 +27,9 @@ describe('ConfigurableModuleBuilder', () => { }); describe('setClassMethodName', () => { it('should set static class method name and return typed builder', () => { - const { ConfigurableModuleClass, initialize } = - new ConfigurableModuleBuilder().setClassMethodName('forRoot').build(); - - initialize(class {}); + const { ConfigurableModuleClass } = new ConfigurableModuleBuilder() + .setClassMethodName('forRoot') + .build(); expect(ConfigurableModuleClass.forRoot).to.not.be.undefined; expect(ConfigurableModuleClass.forRootAsync).to.not.be.undefined; @@ -42,12 +38,9 @@ describe('ConfigurableModuleBuilder', () => { }); describe('setFactoryMethodName', () => { it('should set configuration factory class method name and return typed builder', () => { - const { ConfigurableModuleClass, initialize } = - new ConfigurableModuleBuilder() - .setFactoryMethodName('createOptions') - .build(); - - initialize(class {}); + const { ConfigurableModuleClass } = new ConfigurableModuleBuilder() + .setFactoryMethodName('createOptions') + .build(); expect( ConfigurableModuleClass.registerAsync({ @@ -65,7 +58,6 @@ describe('ConfigurableModuleBuilder', () => { const { ConfigurableModuleClass, - initialize, OPTIONS_TYPE, ASYNC_OPTIONS_TYPE, MODULE_OPTIONS_TOKEN, @@ -85,8 +77,6 @@ describe('ConfigurableModuleBuilder', () => { ) .build(); - initialize(class {}); - const definition = ConfigurableModuleClass.forFeatureAsync({ useFactory: () => {}, isGlobal: true,