From fca686735f86de276ca0f081700e26fb5e71c101 Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Thu, 16 May 2024 16:00:30 -0600 Subject: [PATCH] Add helpful debug information before the assertion Error is thrown, see https://github.com/phetsims/aqua/issues/212 --- js/assert.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/assert.js b/js/assert.js index c4cdfb6..9bd7be8 100644 --- a/js/assert.js +++ b/js/assert.js @@ -36,6 +36,9 @@ Error.stackTraceLimit = 20; } + // eslint-disable-next-line bad-phet-library-text + window.phet?.joist?.sim && console.log( 'Debug info:', JSON.stringify( window.phet.joist.sim.getAssertionDebugInfo(), null, 2 ) ); + throw new Error( assertPrefix + messages.join( '\n ' ) ); } };