MCPcopy
hub / github.com/sveltejs/svelte / assert_html_equal_with_options

Function assert_html_equal_with_options

packages/svelte/tests/html_equal.js:165–192  ·  view source on GitHub ↗
(
	actual,
	expected,
	{ preserveComments, withoutNormalizeHtml },
	message
)

Source from the content-addressed store, hash-verified

163 * @param {string} [message]
164 */
165export const assert_html_equal_with_options = (
166 actual,
167 expected,
168 { preserveComments, withoutNormalizeHtml },
169 message
170) => {
171 try {
172 assert.deepEqual(
173 withoutNormalizeHtml
174 ? normalize_new_line(actual.trim()).replace(
175 /(<!(--)?.*?\2>)/g,
176 preserveComments !== false ? '$1' : ''
177 )
178 : normalize_html(window, actual.trim(), { preserveComments }),
179 withoutNormalizeHtml
180 ? normalize_new_line(expected.trim()).replace(
181 /(<!(--)?.*?\2>)/g,
182 preserveComments !== false ? '$1' : ''
183 )
184 : normalize_html(window, expected.trim(), { preserveComments }),
185 message
186 );
187 } catch (e) {
188 if (Error.captureStackTrace)
189 Error.captureStackTrace(/** @type {Error} */ (e), assert_html_equal_with_options);
190 throw e;
191 }
192};

Callers 3

run_test_variantFunction · 0.90
run_ssr_testFunction · 0.90
test.tsFile · 0.90

Calls 2

normalize_new_lineFunction · 0.85
normalize_htmlFunction · 0.70

Tested by

no test coverage detected