From ab95a7806e544a31c76fe10363f85605c367eeb4 Mon Sep 17 00:00:00 2001 From: Narek Hovhannisyan Date: Wed, 13 Mar 2024 17:21:47 +0400 Subject: [PATCH] Better import debug (#523) * chore(lib): add logging to import * refactor(config): improve invalid module message * test(lib): fix strings --- src/__tests__/unit/config/strings.test.ts | 2 +- src/config/strings.ts | 2 +- src/lib/initialize.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/__tests__/unit/config/strings.test.ts b/src/__tests__/unit/config/strings.test.ts index ada8a8364..e2a97d4b0 100644 --- a/src/__tests__/unit/config/strings.test.ts +++ b/src/__tests__/unit/config/strings.test.ts @@ -13,7 +13,7 @@ describe('config/strings: ', () => { it('successfully appends given param to message.', () => { const param = 'mock-param'; - const expectedMessage = `Provided module path: '${param}' is invalid or not found.`; + const expectedMessage = `Provided module: '${param}' is invalid or not found.`; expect(INVALID_MODULE_PATH(param)).toEqual(expectedMessage); }); diff --git a/src/config/strings.ts b/src/config/strings.ts index 2f324c828..d57241751 100644 --- a/src/config/strings.ts +++ b/src/config/strings.ts @@ -24,7 +24,7 @@ Impact Framework is an alpha release from the Green Software Foundation and is r https://github.com/Green-Software-Foundation/if/issues/new?assignees=&labels=feedback&projects=&template=feedback.md&title=Feedback+-+ `, INVALID_MODULE_PATH: (path: string) => - `Provided module path: '${path}' is invalid or not found.`, + `Provided module: '${path}' is invalid or not found.`, INVALID_TIME_NORMALIZATION: 'Start time or end time is missing.', UNEXPECTED_TIME_CONFIG: 'Unexpected node-level config provided for time-sync plugin.', diff --git a/src/lib/initialize.ts b/src/lib/initialize.ts index cafa4c4ba..1f29a5eaf 100644 --- a/src/lib/initialize.ts +++ b/src/lib/initialize.ts @@ -26,6 +26,7 @@ const importModuleFrom = async (path: string) => { return module; } catch (error) { + logger.error(error); throw new ModuleInitializationError(INVALID_MODULE_PATH(path)); } };