From e9f6a624dbd19057913c2102f2b5bae02cbc6705 Mon Sep 17 00:00:00 2001 From: Chowdhurian Date: Fri, 6 Oct 2017 12:14:09 -0700 Subject: [PATCH] test: include expected result in error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16039 Reviewed-By: Gibson Fahnestock Reviewed-By: Tobias Nießen Reviewed-By: Yuta Hiroto Reviewed-By: Ruben Bridgewater --- test/doctool/test-doctool-html.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 9a4300a5d06e04..40d7b54f59320a 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -115,6 +115,7 @@ testData.forEach((item) => { assert.ifError(err); const actual = output.replace(spaces, ''); + const scriptDomain = 'google-analytics.com'; // Assert that the input stripped of all whitespace contains the // expected list assert(actual.includes(expected)); @@ -122,11 +123,12 @@ testData.forEach((item) => { // Testing the insertion of Google Analytics script when // an analytics id is provided. Should not be present by default if (includeAnalytics) { - assert(actual.includes('google-analytics.com'), - 'Google Analytics script was not present'); + assert(actual.includes(scriptDomain), + `Google Analytics script was not present in "${actual}"`); } else { - assert.strictEqual(actual.includes('google-analytics.com'), false, - 'Google Analytics script was present'); + assert.strictEqual(actual.includes(scriptDomain), false, + 'Google Analytics script was present in ' + + `"${actual}"`); } })); }));