MCPcopy
hub / github.com/webpack/webpack / runTreeCase

Function runTreeCase

test/html5lib.spectest.js:320–333  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

318 * @returns {string} serialized tree
319 */
320const runTreeCase = (c) => {
321 const doc = buildHtmlAst(c.data, c.fragment || undefined);
322 // In fragment mode the result is the children of the synthesized root.
323 const root =
324 c.fragment && doc.children[0]
325 ? /** @type {import("../lib/html/syntax").HtmlDocument} */ ({
326 type: NodeType.Document,
327 children: /** @type {import("../lib/html/syntax").HtmlElement} */ (
328 doc.children[0]
329 ).children
330 })
331 : doc;
332 return serialize(root);
333};
334
335const hasTreeCorpus =
336 fs.existsSync(treeDir) && fs.readdirSync(treeDir).length > 0;

Callers 1

Calls 2

buildHtmlAstFunction · 0.85
serializeFunction · 0.70

Tested by

no test coverage detected