Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

490 B
Raw Blame
import logging
import os
import subprocess


class DiffError(Exception):
    pass


def diff_strings(output: str, expected_output: str) -> str:
    mdiff_path = "web/tests/lib/mdiff.cjs"
    if not os.path.isfile(mdiff_path):  # nocoverage
        msg = "Cannot find mdiff for Markdown diff rendering"
        logging.error(msg)
        raise DiffError(msg)

    command = ["node", mdiff_path, output, expected_output]
    diff = subprocess.check_output(command, text=True)
    return diff