Make the checks pass on a fresh clone
- build.rs creates the empty browser-engine folder that tauri-build requires, so cargo test runs before the browser runtime is staged. - The Table Formulas tests skip with a reason when the package is not built. Before, the missing module failed two whole test files. - The installer test accepts CRLF checkouts and skips with a reason when the NSIS compiler is missing. - hostTodo.spec.mjs never ran because of its extension. Its two valid background tests move to appearance.spec.ts with current defaults. The third test repeated an existing export test. - Remove tsconfig.plugins.json. It checked the plugins/ folder, which moved to separate repositories in 0.1.7.
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test, { before, after } from "node:test";
|
||||
import { ExternalSession } from "../src/lib/plugins/externalSession.ts";
|
||||
// @ts-ignore The compiled package is generated by pnpm build:plugins.
|
||||
import { activate } from "../plugin-packages/table-formulas/main.js";
|
||||
import { existsSync } from "node:fs";
|
||||
// The Table Formulas package comes from a sibling repository. Run `pnpm build:plugins` to build it.
|
||||
const tableFormulasEntry = new URL("../plugin-packages/table-formulas/main.js", import.meta.url);
|
||||
const tableFormulas = existsSync(tableFormulasEntry) ? await import(tableFormulasEntry.href) : undefined;
|
||||
const activate = tableFormulas?.activate;
|
||||
const needsTableFormulas = { skip: tableFormulas ? false : "the Table Formulas package is not built; run pnpm build:plugins" };
|
||||
const session = new ExternalSession("runestone.table-formulas", {
|
||||
workspace: { list: async () => [], read: async () => "", write: async () => {} },
|
||||
settings: { read: async () => null, write: async () => {} },
|
||||
assets: { read: async () => new Uint8Array() },
|
||||
}, () => {}, () => {});
|
||||
before(() => session.start({ activate }));
|
||||
after(() => session.stop());
|
||||
before(() => activate && session.start({ activate }));
|
||||
after(() => activate && session.stop());
|
||||
|
||||
import { tableCellMarkdown } from "../src/lib/editor/tableCellMarkdown.ts";
|
||||
import { renderMarkdownHtml, renderMarkdownSections } from "../src/lib/workspace/noteHtml.ts";
|
||||
|
||||
test("Markdown rendering isolates tables and preserves literal, formatted, and non-table text", () => {
|
||||
test("Markdown rendering isolates tables and preserves literal, formatted, and non-table text", needsTableFormulas, () => {
|
||||
const source = "| X | Y | Result |\r\n| --- | --- | --- |\r\n| 9 | 10 | =AVERAGE(A2:B2) |\r\n\r\n| X | Y | Result |\r\n| --- | --- | --- |\r\n| 1 | 3 | =A2*B2 |\r\n";
|
||||
const html = renderMarkdownHtml(source, new Map());
|
||||
assert.match(html, /aria-label="=AVERAGE\(A2:B2\) → 9.5">9.5<\/span>/);
|
||||
@@ -30,7 +34,7 @@ test("Markdown rendering isolates tables and preserves literal, formatted, and n
|
||||
assert.match(hostile, /#ERROR!/);
|
||||
});
|
||||
|
||||
test("editing keeps formulas readable and code or explicit escapes literal", () => {
|
||||
test("editing keeps formulas readable and code or explicit escapes literal", needsTableFormulas, () => {
|
||||
const doc = (text: string, marks?: { type: string }[]) => ({ type: "doc", content: [{ type: "paragraph", content: [{ type: "text", text, marks }] }] });
|
||||
assert.equal(tableCellMarkdown(doc("=SUM($B$2:C2)*50%")), "=SUM($B$2:C2)*50%");
|
||||
assert.equal(tableCellMarkdown(doc("\\=1+2")), "\\=1+2");
|
||||
|
||||
Reference in New Issue
Block a user