From 02dfbad3072838ce490427c1fd0446f725b3247f Mon Sep 17 00:00:00 2001 From: Iku-turso Date: Wed, 16 Nov 2022 14:22:02 +0200 Subject: [PATCH] Make error for invoking a functional global override more descriptive Co-authored-by: Janne Savolainen Signed-off-by: Iku-turso --- .../test-utils/get-global-override-for-function.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/test-utils/get-global-override-for-function.ts b/src/common/test-utils/get-global-override-for-function.ts index 238ee5621a..63013adcde 100644 --- a/src/common/test-utils/get-global-override-for-function.ts +++ b/src/common/test-utils/get-global-override-for-function.ts @@ -9,10 +9,16 @@ import { camelCase } from "lodash/fp"; export const getGlobalOverrideForFunction = ( injectable: Injectable, ) => - getGlobalOverride(injectable, () => (...args: any[]) => { + getGlobalOverride(injectable, (di) => (...args: any[]) => { console.warn( - `Tried to invoke a function "${injectable.id}" without override. The args were:`, + `Tried to invoke a function "${injectable.id}" without override.`, + "\n\n", + "The args were:", args, + "\n\n", + `The context was: "${di.context + .map((x) => x.injectable.id) + .join(" -> ")}"`, ); throw new Error(