math test: the KaTeX render check skips when katex is not installed in a shared node_modules (#3268)
This commit is contained in:
1 parent
10715d856d
commit
e68a032a58
1 file changed
+3
-2
@@ -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:',
|
||||
'',
|
||||
|
||||
Reference in new issue
Block a user