diff --git a/src/domain/session/room/timeline/deserialize.js b/src/domain/session/room/timeline/deserialize.js index 9421f8f1..7da6255d 100644 --- a/src/domain/session/room/timeline/deserialize.js +++ b/src/domain/session/room/timeline/deserialize.js @@ -352,10 +352,13 @@ export function parseHTMLBody(platform, mediaRepository, allowReplies, html) { return new MessageBody(html, parts); } -import nodeHtmlParser from "node-html-parser"; -const {parse} = nodeHtmlParser; -export function tests() { +export async function tests() { + // don't import node-html-parser until it's safe to assume we're actually in a unit test, + // as this is a devDependency + const nodeHtmlParser = await import("node-html-parser"); + const {parse} = nodeHtmlParser.default; + class HTMLParseResult { constructor(bodyNode) { this._bodyNode = bodyNode;