From ac68fa88f6fe015497d1b8843d76b7490d094dd7 Mon Sep 17 00:00:00 2001 From: "Micael Levi L. Cavalcante" Date: Fri, 21 Apr 2023 21:40:13 -0400 Subject: [PATCH] perf(lib): prioritize 'nest-cli.json' file over all the others patterns --- lib/configuration/nest-configuration.loader.ts | 2 +- test/lib/configuration/nest-configuration.loader.spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/configuration/nest-configuration.loader.ts b/lib/configuration/nest-configuration.loader.ts index 3f7f1f697..65985e941 100644 --- a/lib/configuration/nest-configuration.loader.ts +++ b/lib/configuration/nest-configuration.loader.ts @@ -10,9 +10,9 @@ export class NestConfigurationLoader implements ConfigurationLoader { const content: string | undefined = name ? await this.reader.read(name) : await this.reader.readAnyOf([ + 'nest-cli.json', '.nestcli.json', '.nest-cli.json', - 'nest-cli.json', 'nest.json', ]); diff --git a/test/lib/configuration/nest-configuration.loader.spec.ts b/test/lib/configuration/nest-configuration.loader.spec.ts index 12d4f0108..73fdf3e4a 100644 --- a/test/lib/configuration/nest-configuration.loader.spec.ts +++ b/test/lib/configuration/nest-configuration.loader.spec.ts @@ -29,13 +29,13 @@ describe('Nest Configuration Loader', () => { }); reader = mock(); }); - it('should call reader.readAnyOf when load', async () => { + it('should call reader.readAnyOf when load taking "nest-cli.json" as preferable', async () => { const loader: ConfigurationLoader = new NestConfigurationLoader(reader); const configuration: Configuration = await loader.load(); expect(reader.readAnyOf).toHaveBeenCalledWith([ + 'nest-cli.json', '.nestcli.json', '.nest-cli.json', - 'nest-cli.json', 'nest.json', ]); expect(configuration).toEqual({