test: include expected result in error messages · nodejs/node@ab7f43a

@@ -103,18 +103,20 @@ testData.forEach((item) => {

103103

assert.ifError(err);

104104105105

const actual = output.replace(spaces, '');

106+

const scriptDomain = 'google-analytics.com';

106107

// Assert that the input stripped of all whitespace contains the

107108

// expected list

108109

assert(actual.includes(expected));

109110110111

// Testing the insertion of Google Analytics script when

111112

// an analytics id is provided. Should not be present by default

112113

if (includeAnalytics) {

113-

assert(actual.includes('google-analytics.com'),

114-

'Google Analytics script was not present');

114+

assert(actual.includes(scriptDomain),

115+

`Google Analytics script was not present in "${actual}"`);

115116

} else {

116-

assert.strictEqual(actual.includes('google-analytics.com'), false,

117-

'Google Analytics script was present');

117+

assert.strictEqual(actual.includes(scriptDomain), false,

118+

'Google Analytics script was present in ' +

119+

`"${actual}"`);

118120

}

119121

}));

120122

}));