From b219a8526e57422b9a29b307b7430c4ed7c671bf Mon Sep 17 00:00:00 2001 From: William Grant <willmgrant@gmail.com> Date: Wed, 12 Jun 2024 18:01:50 +1000 Subject: [PATCH] fix: suggest window log stubbing if it's not working when printing render or html elements --- ts/test/test-utils/utils/components.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ts/test/test-utils/utils/components.ts b/ts/test/test-utils/utils/components.ts index 1d9519eb6..d912691bf 100644 --- a/ts/test/test-utils/utils/components.ts +++ b/ts/test/test-utils/utils/components.ts @@ -3,14 +3,18 @@ import { enableLogRedirect } from './stubbing'; const printHTMLElement = async (element: HTMLElement, name?: string) => { if (!window.log || !enableLogRedirect) { - throw Error('window.log is not defined. Have you turned on enableLogRedirect?'); + throw Error( + 'window.log is not defined. Have you turned on enableLogRedirect / called stubWindowLog() ?' + ); } return window.log.debug(`\nHTML Element${name ? ` (${name})` : ''}:\n${prettyDOM(element)}\n`); }; const printRenderResult = async (result: RenderResult, name?: string) => { if (!window.log || !enableLogRedirect) { - throw Error('window.log is not defined. Have you turned on enableLogRedirect?'); + throw Error( + 'window.log is not defined. Have you turned on enableLogRedirect / called stubWindowLog() ?' + ); } return window.log.debug(