From c5bc2cf9536ccc4e0ab87637fbec45ae3a4ecf5f Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 26 Aug 2025 15:58:26 +0200 Subject: [PATCH] better assertion failures --- startup-helper/StartupBenchmark.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/startup-helper/StartupBenchmark.js b/startup-helper/StartupBenchmark.js index 65b44d58..9a1d6686 100644 --- a/startup-helper/StartupBenchmark.js +++ b/startup-helper/StartupBenchmark.js @@ -25,11 +25,20 @@ class StartupBenchmark { expectedCacheCommentCount, sourceCodeReuseCount = 1, } = {}) { - console.assert(iterationCount > 0); + console.assert( + iterationCount > 0, + `Expected iterationCount to be positive, but got ${iterationCount}` + ); this.#iterationCount = iterationCount; - console.assert(expectedCacheCommentCount > 0); + console.assert( + expectedCacheCommentCount > 0, + `Expected expectedCacheCommentCount to be positive, but got ${expectedCacheCommentCount}` + ); this.#expectedCacheCommentCount = expectedCacheCommentCount; - console.assert(sourceCodeReuseCount >= 0); + console.assert( + sourceCodeReuseCount >= 0, + `Expected sourceCodeReuseCount to be non-negative, but got ${sourceCodeReuseCount}` + ); this.#sourceCodeReuseCount = sourceCodeReuseCount; }