forked from mystiq/hydrogen-web
only import node-html-parser when running the unit tests
This commit is contained in:
parent
1a618dd106
commit
bb9362ee8b
1 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue