test: include expected result in error messages
PR-URL: https://github.com/nodejs/node/pull/16039 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
abf8bae475
commit
6a9fd06173
@ -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}"`);
|
||||
}
|
||||
}));
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user