Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(ci): pathlib in shadow-tests hook + happy-dom-robust KaTeX render test (#4425)

LearningCircuit5668b4186a06
diff --git a/tests/js/services/ui.test.js b/tests/js/services/ui.test.js
index 6f1b4a5bbb..5706afc0f5 100644
--- a/tests/js/services/ui.test.js
+++ b/tests/js/services/ui.test.js
@@ -367,7 +367,17 @@ describe('renderMarkdown with KaTeX math', () => {
});
it('renders math alongside other markdown', () => {
- const result = ui.renderMarkdown('# Title\n\nSome text $x^2$ more text\n\n- list item');
+ // The leading "Intro." paragraph is a deliberate sacrificial node.
+ // DOMPurify >=3.4.8 reads element names through a cached
+ // Node.prototype.nodeName getter; under happy-dom's NodeIterator that
+ // path mis-handles the *first* top-level node of the sanitized
+ // fragment, dropping its tags while keeping its text (e.g. a leading
+ // `<h1>Title</h1>` collapses to `Title`). Real browsers use the native
+ // NodeIterator and are unaffected, so this is a test-env-only artifact
+ // (tracked upstream against happy-dom). Prefixing a throwaway paragraph
+ // keeps the heading off the first slot so we can still assert on its
+ // `<h1>` rendering here. See also the MathML note above.
+ const result = ui.renderMarkdown('Intro.\n\n# Title\n\nSome text $x^2$ more text\n\n- list item');
expect(result).toContain('<h1');
expect(result).toContain('<li>');
expect(result).toContain('class="katex"');