From e68a032a581992215d8a3de6019968b1a1df5715 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Tue, 20 Oct 2026 00:43:04 +0200 Subject: [PATCH] math test: the KaTeX render check skips when katex is not installed in a shared node_modules (#3268) --- apps/host/tests/math.test.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/host/tests/math.test.mjs b/apps/host/tests/math.test.mjs index 6adb6ae1..a63c1ad4 100644 --- a/apps/host/tests/math.test.mjs +++ b/apps/host/tests/math.test.mjs @@ -3,7 +3,8 @@ import test from 'node:test'; import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import { transform } from 'esbuild'; -import katex from 'katex'; +// KaTeX is a dependency of the app (npm install / npm ci); a checkout that shares another folder's node_modules may not have it yet +const katex = await import('katex').then(m => m.default, () => null); async function loadTs(path) { const { code } = await transform(await readFile(new URL(path, import.meta.url), 'utf8'), { loader: 'ts', format: 'esm' }); @@ -42,7 +43,7 @@ test('display blocks: one line, several lines, bracket form, and unclosed ones ( assert.equal(displayBlock(['plain'], 0), null); }); -test('the formulas of the report are found in their paragraph and draw without an error', () => { +test('the formulas of the report are found in their paragraph and draw without an error', { skip: katex ? false : 'katex is not installed in node_modules' }, () => { const answer = [ 'Apply Gauss\'s Law for gravity to a sphere of radius $r \\le R$ concentric with the planet:', '',