from __future__ import annotations

import shutil
import subprocess
from pathlib import Path

import pytest


def test_clientside_transform_parity_node() -> None:
    node = shutil.which("node")
    if not node:
        pytest.skip("node is not installed")

    script = (
        Path(__file__).resolve().parent
        / "js"
        / "test_transform_client_parity.js"
    )
    result = subprocess.run(
        [node, str(script)],
        capture_output=True,
        text=True,
        check=False,
    )
    assert result.returncode == 0, result.stderr or result.stdout
