mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-11-20 11:36:24 +01:00
only import node-html-parser when running the unit tests
This commit is contained in:
parent
1a618dd106
commit
bb9362ee8b
@ -352,10 +352,13 @@ export function parseHTMLBody(platform, mediaRepository, allowReplies, html) {
|
|||||||
return new MessageBody(html, parts);
|
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 {
|
class HTMLParseResult {
|
||||||
constructor(bodyNode) {
|
constructor(bodyNode) {
|
||||||
this._bodyNode = bodyNode;
|
this._bodyNode = bodyNode;
|
||||||
|
Loading…
Reference in New Issue
Block a user