fix: bundle qr renderer in relay
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { renderQrPngBase64 } from "./qr-image.js";
|
||||
@@ -8,4 +11,11 @@ describe("renderQrPngBase64", () => {
|
||||
const buf = Buffer.from(b64, "base64");
|
||||
expect(buf.subarray(0, 8).toString("hex")).toBe("89504e470d0a1a0a");
|
||||
});
|
||||
|
||||
it("avoids dynamic require of qrcode-terminal vendor modules", async () => {
|
||||
const sourcePath = resolve(process.cwd(), "src/web/qr-image.ts");
|
||||
const source = await readFile(sourcePath, "utf-8");
|
||||
expect(source).not.toContain("createRequire(");
|
||||
expect(source).not.toContain('require("qrcode-terminal/vendor/QRCode")');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user